package com.example.allshengmedical.experimentanalyze.activity;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Type;
import java.security.PublicKey;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.zip.Inflater;

import javax.security.auth.PrivateCredentialPermission;

import android.R.integer;
import android.app.ActivityManager;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.Loader.ForceLoadContentObserver;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

import com.example.allshengmedical.R;
import com.example.allshengmedical.R.color;
import com.example.allshengmedical.base.BaseActivity;
import com.example.allshengmedical.base.BaseApplication;
import com.example.allshengmedical.experimentanalyze.bean.AdvancedSettingBean;
import com.example.allshengmedical.experimentanalyze.bean.CtSettingBean;
import com.example.allshengmedical.experimentanalyze.presenter.AnalyzeAmplificationplotPresenter;
import com.example.allshengmedical.experimentanalyze.view.IAnalyzeAmplificationplotView;
import com.example.allshengmedical.experimentnew.activity.AbsoluteQuaLayoutActivity;
import com.example.allshengmedical.experimentnew.activity.FileManagerActivity;
import com.example.allshengmedical.experimentnew.activity.KeyboardActivity;
import com.example.allshengmedical.experimentnew.bean.LayoutTableBean;
import com.example.allshengmedical.experimentnew.bean.MethodBean;
import com.example.allshengmedical.experimentrun.activity.AmplifucationActivity;
import com.example.allshengmedical.experimentrun.activity.RunMethodActivity;
import com.example.allshengmedical.experimentrun.activity.RunPreviewActivity;
import com.example.allshengmedical.experimentrun.activity.TemparetureActivity;
import com.example.allshengmedical.experimentrun.activity.RunPreviewActivity.DragGridViewAdapter;
import com.example.allshengmedical.mainmenu.activity.MainMenuActivity;
import com.example.allshengmedical.util.ByAlert;
import com.example.allshengmedical.util.DragGridView;
import com.example.allshengmedical.util.FileManagerUtil;
import com.example.allshengmedical.util.FileParsingUtil;
import com.example.allshengmedical.util.LogUtil;
import com.example.allshengmedical.util.MathLog;
import com.example.allshengmedical.util.SharedPreferencesUtils;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.Legend.LegendForm;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.allsheng.dataprocess.AutoBaseline;

//扩增曲线的
public class AnalyzeAmplificationplotActivity extends BaseActivity
		implements IAnalyzeAmplificationplotView, OnClickListener {
	public final static int TASK_LOOP_COMPLETE = 0;
	ProgressDialog pd;
	private AnalyzeAmplificationplotPresenter amplificationplotPresenter;

	// 基因盘数据
	public ArrayList<LayoutTableBean> activityLayoutTableBeans;

	// 下拉菜单
	private Spinner spinner1, spinner2, spinner3, spinner4;
	private ArrayList<String> data_list1, data_list2, data_list3, data_list4;
	private ArrayAdapter<String> arr_adapter1, arr_adapter2, arr_adapter3, arr_adapter4;
	private int spinner1Postion = 0;
	private int spinner2Postion = 0;
	private int spinner3Postion = 0;
	private int spinner4Postion = 0;

	//
	private boolean menuboo;
	private PopupWindow menuPopupWindow;

	// 数据
	String folderName;
	String fileName;
	private String appFilePath = Environment.getExternalStorageDirectory() + "/" + "AllShengMedical";
	StringBuffer contextString = new StringBuffer();

	// 基因盘
	private DragGridView dragGridView;
	private DragGridViewAdapter dragGridViewAdapter;
	private Button block1Btn, block2Btn;
	// private Boolean blockUpSwitchBoo1 = false, blockDownSwitchBoo1 = false;
	// private Boolean blockUpSwitchBoo2 = false, blockDownSwitchBoo2 = false;
	private String blockStr = "block1";
	private TextView blockUpTv, blockDownTv;
	// 基因盘数据
	public List<HashMap<String, Object>> dataSourceListBlock1 = new ArrayList<HashMap<String, Object>>();
	public List<HashMap<String, Object>> dataSourceListBlock2 = new ArrayList<HashMap<String, Object>>();
	public List<HashMap<String, Object>> dataSourceListBlockToShow = new ArrayList<HashMap<String, Object>>();

	// 曲线图
	// 上半部
	private ArrayList<MethodBean> activityMethodBeans = new ArrayList<MethodBean>();
	// 重复次数
	public int repititions;

	// 曲线
	private LineChart chart;
	// 曲线集合。
	private ArrayList<String> xValues;
	private ArrayList<LineDataSet> dataSets;
	// private LineDataSet dataSet = new LineDataSet(null, "");
	private LineDataSet dataSet = new LineDataSet(null, "");
	private LineDataSet baseLineDataSet = new LineDataSet(null, "");
	// private LineDataSet dataSet2 = new LineDataSet(null, "");
	// private LineDataSet dataSet3 = new LineDataSet(null, "");
	// private LineDataSet dataSet4 = new LineDataSet(null, "");

	public ArrayList<LineDataSet> dataLista1 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataLista2 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataLista3 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataLista4 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataLista5 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataLista6 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataLista7 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataLista8 = new ArrayList<LineDataSet>();

	public ArrayList<LineDataSet> dataListb1 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataListb2 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataListb3 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataListb4 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataListb5 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataListb6 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataListb7 = new ArrayList<LineDataSet>();
	public ArrayList<LineDataSet> dataListb8 = new ArrayList<LineDataSet>();

	private ArrayList<LineDataSet> dataListc1 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc2 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc3 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc4 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc5 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc6 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc7 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc8 = new ArrayList<LineDataSet>();

	private ArrayList<LineDataSet> dataListd1 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd2 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd3 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd4 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd5 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd6 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd7 = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd8 = new ArrayList<LineDataSet>();

	private ArrayList<LineDataSet> dataLista1Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataLista2Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataLista3Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataLista4Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataLista5Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataLista6Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataLista7Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataLista8Sample = new ArrayList<LineDataSet>();

	private ArrayList<LineDataSet> dataListb1Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListb2Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListb3Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListb4Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListb5Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListb6Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListb7Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListb8Sample = new ArrayList<LineDataSet>();

	private ArrayList<LineDataSet> dataListc1Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc2Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc3Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc4Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc5Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc6Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc7Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListc8Sample = new ArrayList<LineDataSet>();

	private ArrayList<LineDataSet> dataListd1Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd2Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd3Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd4Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd5Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd6Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd7Sample = new ArrayList<LineDataSet>();
	private ArrayList<LineDataSet> dataListd8Sample = new ArrayList<LineDataSet>();

	public ArrayList<ArrayList<LineDataSet>> dataListArrayList = new ArrayList<ArrayList<LineDataSet>>();
	private ArrayList<ArrayList<LineDataSet>> dataListLogArrayList = new ArrayList<ArrayList<LineDataSet>>();
	private ArrayList<ArrayList<LineDataSet>> dataListSampleArrayList = new ArrayList<ArrayList<LineDataSet>>();
	private ArrayList<ArrayList<LineDataSet>> dataListLogSampleArrayList = new ArrayList<ArrayList<LineDataSet>>();

	// ct数据
	public HashMap<Integer, LineDataSet> dataListCTArrayList = new HashMap<Integer, LineDataSet>();

	// showbtn
	TextView showTv;
	LinearLayout blockLine, geneLine, toolLine;
	Boolean showBoolean = true;

	// CheckBox
	CheckBox AutoCb, AutoBLCb, BLEndCb, ThresholdCb;
	int AutoCbState;
	TextView numberTv;

	// keyLine
	LinearLayout keyLayout;

	TextView clearTv, allBtn;

	public static AnalyzeAmplificationplotActivity context;

	private AutoBaseline autoBaseline = new AutoBaseline();

	// PassReference
	String passReference = "";
	String passReferenceNum = "-1";

	RelativeLayout white_line;
	private AmplificationUtil amplificationUtil;

	public static AnalyzeAmplificationplotActivity getInstence() {
		return context;
	}

	@Override
	protected int setcontent() {
		return R.layout.activity_analyze_amplificationplot;
	}

	@Override
	protected void initView() {
		System.gc();
		context = this;
		amplificationplotPresenter = new AnalyzeAmplificationplotPresenter(this);
		pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", false, false);
		new TestTask().execute();
		// context = this;
		// amplificationplotPresenter = new
		// AnalyzeAmplificationplotPresenter(this);
		// pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "",
		// "loading...", false, false);
		// final Handler handler = new Handler();
		// final Runnable runnableUi = new Runnable() {
		//
		// @Override
		// public synchronized void run() {
		// dragGridView.setDrag(false);
		//
		// amplificationplotPresenter.initBottomView();
		// getInfo();
		//
		// if (repititions == 0) {
		// // 不能使用此页面
		// white_line.setVisibility(View.VISIBLE);
		// return;
		// } else if (repititions == 1) {
		//
		// // 不能使用此页面
		// white_line.setVisibility(View.VISIBLE);
		// return;
		// } else {
		// white_line.setVisibility(View.GONE);
		// }
		//
		// amplificationplotPresenter.initAppHead();
		//
		// amplificationplotPresenter.initSpinnerView();
		// amplificationplotPresenter.initDragGridView();
		// amplificationplotPresenter.initLineChart();
		// amplificationplotPresenter.initToolLine();
		//
		// initKeyLayout();
		// amplificationUtil = new AmplificationUtil();
		// amplificationUtil.getAnalySetting(context, dataSourceListBlock1,
		// dataSourceListBlock2, repititions,
		// dataListArrayList);
		// dataListCTArrayList = amplificationUtil.getDataListCTArrayList();
		// // 如果选all后面不能操作
		// AutoCb.setClickable(false);
		// numberTv.setClickable(false);
		// AutoBLCb.setClickable(false);
		//
		// // 拟合数据
		// // LogisticFitting logisticFitting = new LogisticFitting();
		// // double[] pX = new double[40];
		// // for (int i = 1; i <= 40; i++) {
		// //
		// // pX[i - 1] = (double) i;
		// // }
		// // double[] pY = new double[] { (double) 18408, (double) 18672,
		// // (double) 18751, (double) 19010, (double) 19167, (double)
		// // 19273,
		// // (double) 19371, (double) 19451, (double) 19481, (double)
		// // 19473,
		// // (double) 19519, (double) 19484, (double) 19444, (double)
		// // 19415,
		// // (double) 19413, (double) 19330, (double) 19311, (double)
		// // 19279,
		// // (double) 19242, (double) 19242, (double) 19203, (double)
		// // 19242,
		// // 19239, (double) 19206, (double) 19235, (double) 19231,
		// // (double) 19332, (double) 19297, (double) 19288, (double)
		// // 19305,
		// // (double) 19316, (double) 19307, (double) 19316, (double)
		// // 19329,
		// // (double) 19374, (double) 19359, (double) 19284, (double)
		// // 19356,
		// // (double) 19374, (double) 19411 };
		// //
		// // logisticFitting.Create(pX, pY, 40);
		//
		// // // AutoBaseline autoBaseline= new AutoBaseline();
		// //
		// // autoBaseline.Create(pY, nTotal);
		//
		// numberTv.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		//
		// if ("All".equals(data_list1.get(spinner1Postion))) {
		// // 如果是全部是没有点击事件的
		// return;
		// } else {
		// if (AutoCb.isChecked()) {
		// // 选中是不能有点急时间的
		// return;
		// } else {
		// Intent keyBoardIntent = new
		// Intent(AnalyzeAmplificationplotActivity.this,
		// KeyboardActivity.class);
		//
		// keyBoardIntent.putExtra("folderName", numberTv.getText());
		// keyBoardIntent.putExtra("title", "Auto Number");
		// keyBoardIntent.putExtra("number", "number");
		// startActivityForResult(keyBoardIntent, 101);
		//
		// }
		// }
		//
		// }
		// });
		//
		// lineDataSets = new ArrayList<LineDataSet>();
		// for (int j = 0; j < amplificationUtil.getCtSettingBeans().size();
		// j++) {
		//
		// LineDataSet line;
		// ArrayList<Entry> yValue = new ArrayList<Entry>();
		// for (int i = 0; i < repititions; i++) {
		// yValue.add(new Entry(
		// Float.parseFloat(amplificationUtil.getCtSettingBeans().get(j).getThreshold().trim()),
		// i));
		// }
		//
		// line = new LineDataSet(yValue, "");
		// line.setColor(Color.RED);
		// line.setCircleSize(0);
		// // line.setDrawCircleHole(true);
		//
		// line.setCircleColor(Color.RED);
		// line.setValueTextSize(0);
		// lineDataSets.add(line);
		//
		// }
		//
		// amplificationUtil.generateDeltaline(dataListArrayList, repititions);
		//
		// }
		// };
		//
		// new Thread() {
		//
		// public synchronized void run() {
		//
		// handler.post(runnableUi);
		// try {
		// messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
		// } catch (Exception e) {
		// // TODO: handle exception
		// }
		// }
		// }.start();

	}

	class TestTask extends AsyncTask<String, String, String> {

		@Override
		protected String doInBackground(String... params) {

			getInfo();
			return null;
		}

		@Override
		protected void onPostExecute(String result) {
			// TODO Auto-generated method stub
			super.onPostExecute(result);

			dragGridView.setDrag(false);

			amplificationplotPresenter.initBottomView();

			amplificationplotPresenter.initAppHead();
			if (repititions == 0) {
				// 不能使用此页面
				white_line.setVisibility(View.VISIBLE);
				SharedPreferencesUtils.put(context, BaseApplication.AnalyzeAmYESORNO, "no");
//				try {
//					messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
//				} catch (Exception e) {
//					// TODO: handle exception
//				}
//				return;
			} else if (repititions == 1) {

				// 不能使用此页面
				white_line.setVisibility(View.VISIBLE);
				SharedPreferencesUtils.put(context, BaseApplication.AnalyzeAmYESORNO, "no");
//				try {
//					messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
//				} catch (Exception e) {
//					// TODO: handle exception
//				}
//				return;
			} else {
				SharedPreferencesUtils.put(context, BaseApplication.AnalyzeAmYESORNO, "yes");
				white_line.setVisibility(View.GONE);
			}
			amplificationplotPresenter.initSpinnerView();
			amplificationplotPresenter.initDragGridView();
			amplificationplotPresenter.initLineChart();
			amplificationplotPresenter.initToolLine();

			initKeyLayout();
			amplificationUtil = new AmplificationUtil();
			amplificationUtil.getAnalySetting(context, dataSourceListBlock1, dataSourceListBlock2, repititions,
					dataListArrayList);
			dataListCTArrayList = amplificationUtil.getDataListCTArrayList();
			// 如果选all后面不能操作
			AutoCb.setClickable(false);
			numberTv.setClickable(false);
			AutoBLCb.setClickable(false);

			// 拟合数据
			// LogisticFitting logisticFitting = new LogisticFitting();
			// double[] pX = new double[40];
			// for (int i = 1; i <= 40; i++) {
			//
			// pX[i - 1] = (double) i;
			// }
			// double[] pY = new double[] { (double) 18408, (double) 18672,
			// (double) 18751, (double) 19010, (double) 19167, (double)
			// 19273,
			// (double) 19371, (double) 19451, (double) 19481, (double)
			// 19473,
			// (double) 19519, (double) 19484, (double) 19444, (double)
			// 19415,
			// (double) 19413, (double) 19330, (double) 19311, (double)
			// 19279,
			// (double) 19242, (double) 19242, (double) 19203, (double)
			// 19242,
			// 19239, (double) 19206, (double) 19235, (double) 19231,
			// (double) 19332, (double) 19297, (double) 19288, (double)
			// 19305,
			// (double) 19316, (double) 19307, (double) 19316, (double)
			// 19329,
			// (double) 19374, (double) 19359, (double) 19284, (double)
			// 19356,
			// (double) 19374, (double) 19411 };
			//
			// logisticFitting.Create(pX, pY, 40);

			// // AutoBaseline autoBaseline= new AutoBaseline();
			//
			// autoBaseline.Create(pY, nTotal);

			numberTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {

					if ("All".equals(data_list1.get(spinner1Postion))) {
						// 如果是全部是没有点击事件的
						return;
					} else {
						if (AutoCb.isChecked()) {
							// 选中是不能有点急时间的
							return;
						} else {
							Intent keyBoardIntent = new Intent(AnalyzeAmplificationplotActivity.this,
									KeyboardActivity.class);

							keyBoardIntent.putExtra("thred", numberTv.getText());
							keyBoardIntent.putExtra("title", "Auto Number");
							keyBoardIntent.putExtra("number", "number");
							startActivityForResult(keyBoardIntent, 101);

						}
					}

				}
			});

			lineDataSets = new ArrayList<LineDataSet>();
			for (int j = 0; j < amplificationUtil.getCtSettingBeans().size(); j++) {

				LineDataSet line;
				ArrayList<Entry> yValue = new ArrayList<Entry>();
				for (int i = 0; i < repititions; i++) {
					yValue.add(new Entry(
							Float.parseFloat(amplificationUtil.getCtSettingBeans().get(j).getThreshold().trim()), i));
				}

				line = new LineDataSet(yValue, "");
				line.setColor(Color.RED);
				line.setCircleSize(0);
				// line.setDrawCircleHole(true);

				line.setCircleColor(Color.RED);
				line.setValueTextSize(0);
				lineDataSets.add(line);

			}

			amplificationUtil.generateDeltaline(dataListArrayList, repititions);

			try {
				messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
			} catch (Exception e) {
				// TODO: handle exception
			}
		}

	}

	private void initKeyLayout() {
		for (LayoutTableBean bean : activityLayoutTableBeans) {
			View mGridView = View.inflate(this, R.layout.item_key, null);
			ImageView color = (ImageView) mGridView.findViewById(R.id.color);
			TextView name = (TextView) mGridView.findViewById(R.id.name);
			color.setBackground(getResources().getDrawable(getcolor(bean.getColor() + "")));
			name.setText(bean.getTarget());
			keyLayout.addView(mGridView);
		}

	}

	private void getInfo() {

		//
		folderName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
				BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "";
		fileName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
				BaseApplication.FILEMANGER_PREPAREFILENAME, "") + "";

		String path = appFilePath + "/" + folderName;

		File file = new File(path + "/" + fileName);

		FileInputStream in = null;
		BufferedReader reader = null;
		contextString = new StringBuffer();
		try {
			in = new FileInputStream(file);
			reader = new BufferedReader(new InputStreamReader(in));
			String line = "";
			while ((line = reader.readLine()) != null) {
				contextString.append(line);
				contextString.append(",");
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			if (reader != null) {
				try {
					reader.close();
				} catch (Exception e2) {
					e2.printStackTrace();
				}
			}
		}

		// BufferedReader reader = null;
		// contextString=new StringBuffer();
		// try {
		// System.out.println("以行为单位读取文件内容，一次读一整行:");
		// reader = new BufferedReader(new FileReader(file));
		// String tempString = null;
		// int line = 1;
		// // 一次读入一行，直到读入null为文件结束
		// while ((tempString = reader.readLine()) != null) {
		// // 显示行号
		// // System.out.println("line " + line + ": " + tempString);
		// // Log.e("--", tempString);
		// contextString.append(tempString);
		// contextString.append(",");
		// line++;
		// }
		// reader.close();
		// } catch (IOException e) {
		// e.printStackTrace();
		// } finally {
		// if (reader != null) {
		// try {
		// reader.close();
		// // LogUtil.e("!!", contextString + "");
		//
		// } catch (IOException e1) {
		// }
		// }
		// }

		passReference = contextString.substring(contextString.indexOf("PassReference:") + 14,
				contextString.indexOf(",,Aisle:"));
		if (!TextUtils.isEmpty(passReference)) {
			// 如果不为空
			// data_list.add("FAM");
			// data_list.add("SYBR Green I");
			// data_list.add("ROX");
			// data_list.add("TEXAS-RED");
			// data_list.add("HEX");
			// data_list.add("JOE");
			// data_list.add("CY3");
			// data_list.add("TET");
			// data_list.add("CY5");
			if (passReference.equals("FAM")) {
				passReferenceNum = "1";
			} else if (passReference.equals("SYBR Green I")) {
				passReferenceNum = "1";
			} else if (passReference.equals("ROX")) {
				passReferenceNum = "3";
			} else if (passReference.equals("TEXAS-RED")) {
				passReferenceNum = "3";
			} else if (passReference.equals("HEX")) {
				passReferenceNum = "2";
			} else if (passReference.equals("JOE")) {
				passReferenceNum = "2";
			} else if (passReference.equals("CY3")) {
				passReferenceNum = "2";
			} else if (passReference.equals("TET")) {
				passReferenceNum = "2";
			} else if (passReference.equals("CY5")) {
				passReferenceNum = "4";
			}

		}

		int index = 0;
		// 上面解析
		while (!(contextString.indexOf("steptType:", index) <= 0)) {

			// steptType:
			String steptType;
			steptType = contextString.substring(contextString.indexOf("steptType:", index) + 10,

					contextString.indexOf(",temperature:", index));

			// LogUtil.e(steptType);

			// temperature
			String temperature;
			temperature = contextString.substring(contextString.indexOf(",temperature:", index) + 13,

					contextString.indexOf(",time:", index));

			// LogUtil.e(temperature);
			// time
			String time;
			time = contextString.substring(contextString.indexOf(",time:", index) + 6,

					contextString.indexOf(",goTo:", index));
					// LogUtil.e(time);

			// goTo
			String goTo;
			goTo = contextString.substring(contextString.indexOf(",goTo:", index) + 6,

					contextString.indexOf(",Repititions:", index));
			// LogUtil.e(goTo);
			// Repititions
			String repititions;
			repititions = contextString.substring(contextString.indexOf(",Repititions:", index) + 13,

					contextString.indexOf(",deltaT:", index));
			// LogUtil.e(repititions);
			// deltaT
			String deltaT;
			deltaT = contextString.substring(contextString.indexOf(",deltaT:", index) + 8,

					contextString.indexOf(",rightSelect:", index));
			// LogUtil.e(deltaT);

			int nextIndex = contextString.indexOf("steptType:", index) + 10;

			// rightSelect
			String rightSelect;

			if (contextString.indexOf(",steptType:", nextIndex) < 0) {
				rightSelect = contextString.substring(contextString.indexOf(",rightSelect:", index) + 13,
						contextString.indexOf(",,pointMap", index));
				if ("null".equals(rightSelect)) {
					rightSelect = "";
				}

			} else {
				rightSelect = contextString.substring(contextString.indexOf(",rightSelect:", index) + 13,

						contextString.indexOf(",steptType:", nextIndex));
				if ("null".equals(rightSelect)) {
					rightSelect = "";
				}
			}
			// LogUtil.e(rightSelect);
			index = contextString.indexOf(",rightSelect:", index) + 13;

			activityMethodBeans.add(new MethodBean(steptType.trim(), temperature.trim(), time.trim(), goTo.trim(),
					repititions.trim(), deltaT.trim()));
		}
		// 获取重复次数

		int stepNum = Integer.parseInt(contextString
				.substring(contextString.indexOf(",readDataString: ") + 17, contextString.indexOf(",,Methods")).trim());
		getRepititions(stepNum);
		// repititions = Integer.parseInt(activityMethodBeans.get(stepNum -
		// 1).getRepititions());
	}

	private void getRepititions(int stepNum) {
		// 先找出拍照的位置
		int cameraStep = stepNum - 1;
		// for (MethodBean bean : activityMethodBeans) {
		// if (bean.getRightSelect()) {
		// break;
		// }
		// cameraStep++;
		// }
		ArrayList<ArrayList<Integer>> ranges = new ArrayList<ArrayList<Integer>>();
		ArrayList<Integer> littleRange;
		int startStep = 0;
		for (MethodBean bean : activityMethodBeans) {
			if (!TextUtils.isEmpty(bean.getGoTo())) {
				littleRange = new ArrayList<Integer>();
				littleRange.add(startStep);
				littleRange.add(Integer.parseInt(bean.getGoTo()) - 1);
				ranges.add(littleRange);
			}
			startStep++;
		}

		// 判断有没有跳转
		if (ranges.size() == 0) {
			repititions = 1;
			return;
		} else {
			int sum = 1;
			for (ArrayList<Integer> little : ranges) {
				if (cameraStep <= little.get(0)) {
					if (cameraStep >= little.get(1)) {
						sum = sum * Integer.parseInt(activityMethodBeans.get(little.get(0)).getRepititions());
					}
				}
			}
			repititions = sum;
			return;
		}

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.showTv:

			if (showBoolean) {
				blockLine.setVisibility(View.INVISIBLE);
				geneLine.setVisibility(View.INVISIBLE);
				toolLine.setVisibility(View.VISIBLE);
				clearTv.setVisibility(View.INVISIBLE);
				showTv.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
				showTv.setTextColor(Color.parseColor("#ffffff"));
			} else {
				blockLine.setVisibility(View.VISIBLE);
				geneLine.setVisibility(View.VISIBLE);
				toolLine.setVisibility(View.INVISIBLE);
				clearTv.setVisibility(View.VISIBLE);
				showTv.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));
				showTv.setTextColor(Color.parseColor("#000000"));
			}
			showBoolean = !showBoolean;
			break;
		case R.id.clearTv:
			for (HashMap<String, Object> bean : dataSourceListBlock1) {
				bean.put("item_selected", false);
			}
			for (HashMap<String, Object> bean : dataSourceListBlock2) {
				bean.put("item_selected", false);
			}

			dragGridViewAdapter.notifyDataSetChanged();
			dataSets.clear();
			LineData lineData = new LineData(xValues, dataSets);
			// mLineChart2.setBackgroundColor(Color.BLUE);
			chart.setGridBackgroundColor(Color.WHITE);
			// 将数据插入
			chart.setData(lineData);
			Legend mLegend = chart.getLegend(); //
			// 设置比例图标示，就是那个一组y的value的
			mLegend.setXEntrySpace(7f);
			mLegend.setYEntrySpace(5f);
			chart.animateX(0); // 立即执行的动画,x轴

			break;
		case R.id.allBtn:
			for (HashMap<String, Object> bean : dataSourceListBlock1) {
				bean.put("item_selected", true);
			}
			for (HashMap<String, Object> bean : dataSourceListBlock2) {
				bean.put("item_selected", true);
			}
			dragGridViewAdapter.notifyDataSetChanged();
			// 在这里加曲线！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！！
			dataSets.clear();
			// 判断当前的曲线类型
			// 如果不是all
			if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
				for (int position = 0; position < 16; position++) {

					// 判断通道是否是一个。是显示曲线
					// 因为名字可能重复。所以决定用颜色做判断
					if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
							.equals(dataSourceListBlock1.get(position).get("item_image") + "")) {
						// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
						if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

						} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaLogArrayList().get(position).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaArrayList().get(position).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(position)
												.get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							}

						} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 2) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaLogArrayList().get(position).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaArrayList().get(position).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(position)
												.get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							}
						} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 3) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaLogArrayList().get(position).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaArrayList().get(position).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(position)
												.get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							}
						} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 4) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaLogArrayList().get(position).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(
												amplificationUtil.getDataListDeltaArrayList().get(position).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(position)
												.get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND1(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 1);
									}

								}
							}
						}
					}
					// 不是不显示
					else {

					}

				}
				for (int position = 0; position < 16; position++) {

					// 判断通道是否是一个。是显示曲线
					// 因为名字可能重复。所以决定用颜色做判断
					if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
							.equals(dataSourceListBlock2.get(position).get("item_image") + "")) {
						// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
						if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

						} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position + 16)
												.get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}

									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position + 16).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position + 16)
												.get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position + 16).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position + 16).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position + 16).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
												.get(position + 16).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position + 16).get(0));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							}

						} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 2) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position + 16)
												.get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position + 16).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position + 16)
												.get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position + 16).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position + 16).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position + 16).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
												.get(position + 16).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position + 16).get(1));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							}
						} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 3) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position + 16)
												.get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position + 16).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position + 16)
												.get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position + 16).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position + 16).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position + 16).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
												.get(position + 16).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position + 16).get(2));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							}
						} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 4) {
							if (spinner4Postion == 0) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position + 16)
												.get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogArrayList.get(position + 16).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position + 16)
												.get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListArrayList.get(position + 16).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							} else if (spinner4Postion == 1) {
								if (spinner3Postion == 1) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
												.get(position + 16).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListLogSampleArrayList.get(position + 16).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								} else if (spinner3Postion == 0) {
									if (spinner2Postion == 0) {
										dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
												.get(position + 16).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 1) {
										dataSets.add(dataListSampleArrayList.get(position + 16).get(3));
										if (BLEndCb.isChecked()) {
											addBLEND2(position, 1);
										}
									} else if (spinner2Postion == 2) {
										spinner22Util(position, true, 2);
									}

								}
							}
						}
					}
					// 不是不显示
					else {

					}

				}
			} else {
				// all
				for (int position = 0; position < 16; position++) {

					if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

					} else {

						if (spinner4Postion == 0) {
							if (spinner3Postion == 1) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {
											dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position)
													.get(i));
											// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position)
											// .get(1));
											// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position)
											// .get(2));
											// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position)
											// .get(3));
										}
									}

									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {
											dataSets.add(dataListLogArrayList.get(position).get(i));
											// dataSets.add(dataListLogArrayList.get(position).get(1));
											// dataSets.add(dataListLogArrayList.get(position).get(2));
											// dataSets.add(dataListLogArrayList.get(position).get(3));

										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 1);
								}

							} else if (spinner3Postion == 0) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {
											dataSets.add(
													amplificationUtil.getDataListDeltaArrayList().get(position).get(i));
											// dataSets.add(
											// amplificationUtil.getDataListDeltaArrayList().get(position).get(1));
											// dataSets.add(
											// amplificationUtil.getDataListDeltaArrayList().get(position).get(2));
											// dataSets.add(
											// amplificationUtil.getDataListDeltaArrayList().get(position).get(3));

										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(dataListArrayList.get(position).get(i));
											// dataSets.add(dataListArrayList.get(position).get(1));
											// dataSets.add(dataListArrayList.get(position).get(2));
											// dataSets.add(dataListArrayList.get(position).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 1);
								}

							}
						} else if (spinner4Postion == 1) {
							if (spinner3Postion == 1) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {
											dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position).get(i));
											// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
											// .get(position).get(1));
											// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
											// .get(position).get(2));
											// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
											// .get(position).get(3));

										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {
											dataSets.add(dataListLogSampleArrayList.get(position).get(i));
											// dataSets.add(dataListLogSampleArrayList.get(position).get(1));
											// dataSets.add(dataListLogSampleArrayList.get(position).get(2));
											// dataSets.add(dataListLogSampleArrayList.get(position).get(3));

										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 1);
								}

							} else if (spinner3Postion == 0) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {
											dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position).get(i));
											// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
											// .get(position).get(1));
											// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
											// .get(position).get(2));
											// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
											// .get(position).get(3));

										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {
											dataSets.add(dataListSampleArrayList.get(position).get(0));
											// dataSets.add(dataListSampleArrayList.get(position).get(1));
											// dataSets.add(dataListSampleArrayList.get(position).get(2));
											// dataSets.add(dataListSampleArrayList.get(position).get(3));

										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND1ALL(position, 1);
									}
								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 1);
								}

							}
						}

					}

				}
				for (int position = 0; position < 16; position++) {

					if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

					} else {
						if (spinner4Postion == 0) {
							if (spinner3Postion == 1) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position + 16).get(i));
											// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
											// .get(position +
											// 16).get(1));
											// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
											// .get(position +
											// 16).get(2));
											// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
											// .get(position +
											// 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(dataListLogArrayList.get(position + 16).get(i));
											// dataSets.add(dataListLogArrayList.get(position
											// + 16).get(1));
											// dataSets.add(dataListLogArrayList.get(position
											// + 16).get(2));
											// dataSets.add(dataListLogArrayList.get(position
											// + 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 2);
								}

							} else if (spinner3Postion == 0) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(amplificationUtil.getDataListDeltaArrayList()
													.get(position + 16).get(i));
											// dataSets.add(amplificationUtil.getDataListDeltaArrayList()
											// .get(position +
											// 16).get(1));
											// dataSets.add(amplificationUtil.getDataListDeltaArrayList()
											// .get(position +
											// 16).get(2));
											// dataSets.add(amplificationUtil.getDataListDeltaArrayList()
											// .get(position +
											// 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(dataListArrayList.get(position + 16).get(i));
											// dataSets.add(dataListArrayList.get(position
											// + 16).get(1));
											// dataSets.add(dataListArrayList.get(position
											// + 16).get(2));
											// dataSets.add(dataListArrayList.get(position
											// + 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 2);
								}

							}
						} else if (spinner4Postion == 1) {
							if (spinner3Postion == 1) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position + 16).get(i));
											// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
											// .get(position +
											// 16).get(1));
											// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
											// .get(position +
											// 16).get(2));
											// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
											// .get(position +
											// 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(dataListLogSampleArrayList.get(position + 16).get(i));
											// dataSets.add(dataListLogSampleArrayList.get(position
											// + 16).get(1));
											// dataSets.add(dataListLogSampleArrayList.get(position
											// + 16).get(2));
											// dataSets.add(dataListLogSampleArrayList.get(position
											// + 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 2);
								}

							} else if (spinner3Postion == 0) {
								if (spinner2Postion == 0) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position + 16).get(i));
											// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
											// .get(position +
											// 16).get(1));
											// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
											// .get(position +
											// 16).get(2));
											// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
											// .get(position +
											// 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 1) {
									for (int i = 0; i < 4; i++) {
										if (i == Integer.parseInt(passReferenceNum) - 1) {

										} else {

											dataSets.add(dataListSampleArrayList.get(position + 16).get(i));
											// dataSets.add(dataListSampleArrayList.get(position
											// + 16).get(1));
											// dataSets.add(dataListSampleArrayList.get(position
											// + 16).get(2));
											// dataSets.add(dataListSampleArrayList.get(position
											// + 16).get(3));
										}
									}
									if (BLEndCb.isChecked()) {
										addBLEND2ALL(position, 1);
									}

								} else if (spinner2Postion == 2) {
									spinner22Util(position, true, 2);
								}

							}
						}

					}

				}

			}

			LineData lineData1 = new LineData(xValues, dataSets);
			// mLineChart2.setBackgroundColor(Color.BLUE);
			chart.setGridBackgroundColor(Color.WHITE);
			// 将数据插入
			chart.setData(lineData1);
			Legend mLegend1 = chart.getLegend(); //
			// 设置比例图标示，就是那个一组y的value的
			mLegend1.setXEntrySpace(7f);
			mLegend1.setYEntrySpace(5f);
			chart.animateX(0); // 立即执行的动画,x轴
			break;
		case R.id.blockUpTv:
			if ("block1".equals(blockStr)) {
				// for (HashMap<String, Object> bean : dataSourceListBlock1) {
				for (int i = 0; i < 8; i++) {
					dataSourceListBlock1.get(i).put("item_selected", true);
				}

			} else if ("block2".equals(blockStr)) {
				for (int i = 0; i < 8; i++) {
					dataSourceListBlock2.get(i).put("item_selected", true);
				}
			}
			dragGridViewAdapter.notifyDataSetChanged();

			// 判断set里面有没有曲线

			break;
		case R.id.blockDownTv:
			if ("block1".equals(blockStr)) {
				for (int i = 8; i < 16; i++) {
					dataSourceListBlock1.get(i).put("item_selected", true);
				}

			} else if ("block2".equals(blockStr)) {
				for (int i = 8; i < 16; i++) {
					dataSourceListBlock2.get(i).put("item_selected", true);
				}
			}
			dragGridViewAdapter.notifyDataSetChanged();

			// 判断set里面有没有曲线
			break;
		default:
			break;
		}

	}

	@Override
	protected void initData() {

	}

	@Override
	public void initAppHead() {
		setActionBar();
		setSystemTime();
	}

	@Override
	public void initBottomView() {
		// setBottomView();
	}

	@Override
	public void initLineChart() {
		XAxis xAxis = chart.getXAxis();

		// 设置X轴的文字在底部
		xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

		xAxis.setGridColor(getResources().getColor(R.color.darkWhite));// : //
																		// 设置该轴的网格线颜色。
		xAxis.setGridLineWidth(1f); // : 设置该轴网格线的宽度。
		xAxis.setAxisLineColor(getResources().getColor(R.color.darkWhite));// 设置轴线的轴的颜色。
		xAxis.setAxisLineWidth(1f);// : 设置该轴轴行的宽度。
		xAxis.setTextColor(getResources().getColor(R.color.textcolor_gray));
		// 设置描述文字
		chart.setDescription("");

		xValues = new ArrayList<String>();
		for (int i = 1; i < repititions + 2; i++) {
			xValues.add(i + "");
		}

		// 模拟一组y轴数据(存放y轴数据的是一个Entry的ArrayList) 他是构建LineDataSet的参数之一

		ArrayList<Entry> yValues = new ArrayList<Entry>();
		// for (int i = 0; i < 11; i++) {
		// yValue.add(new Entry(i, i));
		// }

		contextString = new StringBuffer(contextString
				.substring(contextString.indexOf("Amplification Data"), contextString.length()).toString());
		for (int n = 1; n <= 4; n++) {
			int index = 0;
			String linshi = "";// 判断通道是否有数据
			switch (n) {
			case 1:
				index = contextString.indexOf("Channel1,line1,") + 9;

				linshi = contextString.substring(contextString.indexOf("line1" + ",", index - 1) + 5,

						contextString.indexOf("line2" + ",", index));

				break;
			case 2:
				index = contextString.indexOf("Channel2,line1,") + 9;
				linshi = contextString.substring(contextString.indexOf("line1" + ",", index - 1) + 5,

						contextString.indexOf("line2" + ",", index));
				break;
			case 3:
				index = contextString.indexOf("Channel3,line1,") + 9;
				linshi = contextString.substring(contextString.indexOf("line1" + ",", index - 1) + 5,

						contextString.indexOf("line2" + ",", index));
				break;
			case 4:
				index = contextString.indexOf("Channel4,line1,") + 9;
				linshi = contextString.substring(contextString.indexOf("line1" + ",", index - 1) + 5,

						contextString.indexOf("line2" + ",", index));
				break;
			default:
				break;
			}
			// asd
			for (int i = 1; i <= 32; i++) {
				yValues = new ArrayList<Entry>();
				// 截取当前线所有数据
				int nexti = i + 1;
				String lineDataStr = "";

				if (i < 32) {
					lineDataStr = contextString.substring(contextString.indexOf("line" + i + ",", index - 1) + 5,

							contextString.indexOf("line" + nexti + ",", index));
				} else {
					lineDataStr = contextString.substring(contextString.indexOf("line" + i + ",", index - 1) + 5);
				}

				int indexj = 0;
				for (int j = 0; j < repititions; j++) {
					Float fyValue = 0f;

					if (j < 10) {
						int firstDouhao = lineDataStr.indexOf(",", indexj) + 1;
						try {

							fyValue = Float.parseFloat(lineDataStr.substring(lineDataStr.indexOf(",", indexj) + 1,

									lineDataStr.indexOf(",", firstDouhao)));

						} catch (Exception e) {
							// TODO: handle exception
						}

						yValues.add(new Entry(fyValue, j));
					} else {

						int firstDouhao = lineDataStr.indexOf(",", indexj) + 1;
						try {
							fyValue = Float.parseFloat(lineDataStr.substring(lineDataStr.indexOf(",", indexj) + 1,

									lineDataStr.indexOf(",", firstDouhao)));

							yValues.add(new Entry(fyValue, j));
						} catch (Exception e) {
							// TODO: handle exception
						}

					}
					indexj = lineDataStr.indexOf(",", indexj) + 1;

				}
				String color = "";
				switch (i) {
				case 1:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista1.add(lineDataSet);
						dataLista1Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(0).get("item_image").toString(), 1);
						dataLista1.add(dataSet);

						if ("sample".equals(dataSourceListBlock1.get(0).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(0).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(0).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(0).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista1Sample.add(dataSet);
					}

					break;
				case 2:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista2.add(lineDataSet);
						dataLista2Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(1).get("item_image").toString(), 1);
						dataLista2.add(dataSet);

						if ("sample".equals(dataSourceListBlock1.get(1).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(1).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(1).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(1).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista2Sample.add(dataSet);
					}
					break;
				case 3:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista3.add(lineDataSet);
						dataLista3Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(2).get("item_image").toString(), 1);
						dataLista3.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(2).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(2).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(2).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(2).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista3Sample.add(dataSet);
					}
					break;
				case 4:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista4.add(lineDataSet);
						dataLista4Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(3).get("item_image").toString(), 1);
						dataLista4.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(3).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(3).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(3).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(3).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista4Sample.add(dataSet);
					}
					break;
				case 5:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista5.add(lineDataSet);
						dataLista5Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(4).get("item_image").toString(), 1);
						dataLista5.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(4).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(4).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(4).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(4).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista5Sample.add(dataSet);
					}
					break;
				case 6:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista6.add(lineDataSet);
						dataLista6Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(5).get("item_image").toString(), 1);
						dataLista6.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(5).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(5).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(5).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(5).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista6Sample.add(dataSet);
					}
					break;
				case 7:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista7.add(lineDataSet);
						dataLista7Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(6).get("item_image").toString(), 1);
						dataLista7.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(6).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(6).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(6).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(6).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista7Sample.add(dataSet);
					}
					break;
				case 8:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataLista8.add(lineDataSet);
						dataLista8Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(7).get("item_image").toString(), 1);
						dataLista8.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(7).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(7).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(7).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(7).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataLista8Sample.add(dataSet);
					}
					break;
				case 9:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb1.add(lineDataSet);
						dataListb1Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(8).get("item_image").toString(), 1);
						dataListb1.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(8).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(8).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(8).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(8).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb1Sample.add(dataSet);
					}
					break;
				case 10:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb2.add(lineDataSet);
						dataListb2Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(9).get("item_image").toString(), 1);
						dataListb2.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(9).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(9).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(9).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(9).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb2Sample.add(dataSet);
					}
					break;
				case 11:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb3.add(lineDataSet);
						dataListb3Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(10).get("item_image").toString(), 1);
						dataListb3.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(10).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(10).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(10).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(10).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb3Sample.add(dataSet);
					}
					break;
				case 12:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb4.add(lineDataSet);
						dataListb4Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(11).get("item_image").toString(), 1);
						dataListb4.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(11).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(11).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(11).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(11).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb4Sample.add(dataSet);
					}
					break;
				case 13:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb5.add(lineDataSet);
						dataListb5Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(12).get("item_image").toString(), 1);
						dataListb5.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(12).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(12).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(12).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(12).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb5Sample.add(dataSet);
					}
					break;
				case 14:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb6.add(lineDataSet);
						dataListb6Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(13).get("item_image").toString(), 1);
						dataListb6.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(13).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(13).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(13).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(13).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb6Sample.add(dataSet);
					}
					break;
				case 15:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb7.add(lineDataSet);
						dataListb7Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(14).get("item_image").toString(), 1);
						dataListb7.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(14).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(14).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(14).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(14).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb7Sample.add(dataSet);
					}
					break;
				case 16:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListb8.add(lineDataSet);
						dataListb8Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock1.get(15).get("item_image").toString(), 1);
						dataListb8.add(dataSet);
						if ("sample".equals(dataSourceListBlock1.get(15).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock1.get(15).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock1.get(15).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock1.get(15).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListb8Sample.add(dataSet);
					}
					break;
				case 17:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc1.add(lineDataSet);
						dataListc1Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(0).get("item_image").toString(), 1);
						dataListc1.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(0).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(0).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(0).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(0).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc1Sample.add(dataSet);
					}
					break;
				case 18:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc2.add(lineDataSet);
						dataListc2Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(1).get("item_image").toString(), 1);
						dataListc2.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(1).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(1).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(1).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(1).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc2Sample.add(dataSet);
					}
					break;
				case 19:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc3.add(lineDataSet);
						dataListc3Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(2).get("item_image").toString(), 1);
						dataListc3.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(2).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(2).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(2).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(2).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc3Sample.add(dataSet);
					}
					break;
				case 20:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc4.add(lineDataSet);
						dataListc4Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(3).get("item_image").toString(), 1);
						dataListc4.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(3).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(3).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(3).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(3).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc4Sample.add(dataSet);
					}
					break;
				case 21:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc5.add(lineDataSet);
						dataListc5Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(4).get("item_image").toString(), 1);
						dataListc5.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(4).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(4).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(4).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(4).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc5Sample.add(dataSet);
					}
					break;
				case 22:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc6.add(lineDataSet);
						dataListc6Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(5).get("item_image").toString(), 1);
						dataListc6.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(5).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(5).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(5).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(5).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc6Sample.add(dataSet);
					}
					break;
				case 23:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc7.add(lineDataSet);
						dataListc7Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(6).get("item_image").toString(), 1);
						dataListc7.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(6).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(6).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(6).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(6).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc7Sample.add(dataSet);
					}
					break;
				case 24:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListc8.add(lineDataSet);
						dataListc8Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(7).get("item_image").toString(), 1);
						dataListc8.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(7).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(7).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(7).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(7).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListc8Sample.add(dataSet);
					}
					break;
				case 25:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd1.add(lineDataSet);
						dataListd1Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(8).get("item_image").toString(), 1);
						dataListd1.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(8).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(8).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(8).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(8).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd1Sample.add(dataSet);
					}
					break;
				case 26:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd2.add(lineDataSet);
						dataListd2Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(9).get("item_image").toString(), 1);
						dataListd2.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(9).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(9).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(9).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(9).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd2Sample.add(dataSet);
					}

					break;
				case 27:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd3.add(lineDataSet);
						dataListd3Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(10).get("item_image").toString(), 1);
						dataListd3.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(10).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(10).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(10).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(10).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd3Sample.add(dataSet);
					}
					break;
				case 28:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd4.add(lineDataSet);
						dataListd4Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(11).get("item_image").toString(), 1);
						dataListd4.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(11).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(11).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(11).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(11).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd4Sample.add(dataSet);
					}
					break;
				case 29:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd5.add(lineDataSet);
						dataListd5Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(12).get("item_image").toString(), 1);
						dataListd5.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(12).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(12).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(12).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(12).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd5Sample.add(dataSet);
					}
					break;

				case 30:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd6.add(lineDataSet);
						dataListd6Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(13).get("item_image").toString(), 1);
						dataListd6.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(13).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(13).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(13).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(13).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd6Sample.add(dataSet);
					}
					break;
				case 31:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd7.add(lineDataSet);
						dataListd7Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(14).get("item_image").toString(), 1);
						dataListd7.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(14).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(14).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(14).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(14).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd7Sample.add(dataSet);
					}
					break;
				case 32:
					if (linshi.length() < 2) {
						LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), "");
						dataListd8.add(lineDataSet);
						dataListd8Sample.add(lineDataSet);
					} else {
						addLineChart(yValues, dataSourceListBlock2.get(15).get("item_image").toString(), 1);
						dataListd8.add(dataSet);
						if ("sample".equals(dataSourceListBlock2.get(15).get("item_type"))) {
							color = "#ff2d55";
						} else if ("standard".equals(dataSourceListBlock2.get(15).get("item_type"))) {
							color = "#fd9727";
						} else if ("positive".equals(dataSourceListBlock2.get(15).get("item_type"))) {
							color = "#ff00a9";
						} else if ("negative".equals(dataSourceListBlock2.get(15).get("item_type"))) {
							color = "#159588";

						} else {
							color = "#ffffff";
						}
						addLineChart(yValues, color, 2);
						dataListd8Sample.add(dataSet);
					}
					break;

				default:
					break;
				}
				index = contextString.indexOf("line" + nexti + ",", index);

			}

		}

		// 构建一个LineDataSet 代表一组Y轴数据 （比如不同的彩票: 七星彩 双色球）

		// dataSeta8 = new LineDataSet(yValue7, "");
		// dataSeta8.setColor(Color.RED);// 设置颜色
		// dataSeta8.setLineWidth(1);
		// dataSeta8.setCircleSize(0f);
		// dataSeta8.setValueTextSize(0);

		// 把数据都放到总集合中dataListArrayList
		dataListArrayList.add(dataLista1);
		dataListArrayList.add(dataLista2);
		dataListArrayList.add(dataLista3);
		dataListArrayList.add(dataLista4);
		dataListArrayList.add(dataLista5);
		dataListArrayList.add(dataLista6);
		dataListArrayList.add(dataLista7);
		dataListArrayList.add(dataLista8);
		dataListArrayList.add(dataListb1);
		dataListArrayList.add(dataListb2);
		dataListArrayList.add(dataListb3);
		dataListArrayList.add(dataListb4);
		dataListArrayList.add(dataListb5);
		dataListArrayList.add(dataListb6);
		dataListArrayList.add(dataListb7);
		dataListArrayList.add(dataListb8);
		dataListArrayList.add(dataListc1);
		dataListArrayList.add(dataListc2);
		dataListArrayList.add(dataListc3);
		dataListArrayList.add(dataListc4);
		dataListArrayList.add(dataListc5);
		dataListArrayList.add(dataListc6);
		dataListArrayList.add(dataListc7);
		dataListArrayList.add(dataListc8);
		dataListArrayList.add(dataListd1);
		dataListArrayList.add(dataListd2);
		dataListArrayList.add(dataListd3);
		dataListArrayList.add(dataListd4);
		dataListArrayList.add(dataListd5);
		dataListArrayList.add(dataListd6);
		dataListArrayList.add(dataListd7);
		dataListArrayList.add(dataListd8);

		// sample
		dataListSampleArrayList.add(dataLista1Sample);
		dataListSampleArrayList.add(dataLista2Sample);
		dataListSampleArrayList.add(dataLista3Sample);
		dataListSampleArrayList.add(dataLista4Sample);
		dataListSampleArrayList.add(dataLista5Sample);
		dataListSampleArrayList.add(dataLista6Sample);
		dataListSampleArrayList.add(dataLista7Sample);
		dataListSampleArrayList.add(dataLista8Sample);
		dataListSampleArrayList.add(dataListb1Sample);
		dataListSampleArrayList.add(dataListb2Sample);
		dataListSampleArrayList.add(dataListb3Sample);
		dataListSampleArrayList.add(dataListb4Sample);
		dataListSampleArrayList.add(dataListb5Sample);
		dataListSampleArrayList.add(dataListb6Sample);
		dataListSampleArrayList.add(dataListb7Sample);
		dataListSampleArrayList.add(dataListb8Sample);
		dataListSampleArrayList.add(dataListc1Sample);
		dataListSampleArrayList.add(dataListc2Sample);
		dataListSampleArrayList.add(dataListc3Sample);
		dataListSampleArrayList.add(dataListc4Sample);
		dataListSampleArrayList.add(dataListc5Sample);
		dataListSampleArrayList.add(dataListc6Sample);
		dataListSampleArrayList.add(dataListc7Sample);
		dataListSampleArrayList.add(dataListc8Sample);
		dataListSampleArrayList.add(dataListd1Sample);
		dataListSampleArrayList.add(dataListd2Sample);
		dataListSampleArrayList.add(dataListd3Sample);
		dataListSampleArrayList.add(dataListd4Sample);
		dataListSampleArrayList.add(dataListd5Sample);
		dataListSampleArrayList.add(dataListd6Sample);
		dataListSampleArrayList.add(dataListd7Sample);
		dataListSampleArrayList.add(dataListd8Sample);

		// bean=dataListArrayList。get（）32
		// for (ArrayList<LineDataSet> bean : dataListArrayList) {

		for (int x = 0; x < 32; x++) {

			ArrayList<LineDataSet> dataList = null;
			dataList = new ArrayList<LineDataSet>();
			String color = "";
			if (x <= 15) {
				color = dataSourceListBlock1.get(x).get("item_image").toString();
			} else {
				color = dataSourceListBlock2.get(x - 16).get("item_image").toString();
			}

			for (int j = 0; j < 4; j++) {
				ArrayList<Entry> yValueslog = new ArrayList<Entry>();

				for (int i = 0; i < repititions; i++) {

					// log数据改这里
					if (dataListArrayList.get(x).get(j) != null) {
						try {
							yValueslog
									.add(new Entry(
											(float) MathLog.log(
													dataListArrayList.get(x).get(j).getYVals().get(i).getVal(), 10),
											i));
						} catch (Exception e) {
							// TODO: handle exception
						}

					}

					// yValueslog.add(autoBaseline.getLogValue(pY, nTotal),i);

				}
				addLineChart(yValueslog, color, 1);
				// dataLista1.add(dataSet);
				dataList.add(dataSet);

			}
			dataListLogArrayList.add(dataList);

		}
		// sample
		for (int x = 0; x < 16; x++) {

			ArrayList<LineDataSet> dataList = null;
			dataList = new ArrayList<LineDataSet>();
			String color = "";
			if ("sample".equals(dataSourceListBlock1.get(x).get("item_type"))) {
				color = "#ff2d55";
			} else if ("standard".equals(dataSourceListBlock1.get(x).get("item_type"))) {
				color = "#fd9727";
			} else if ("positive".equals(dataSourceListBlock1.get(x).get("item_type"))) {
				color = "#ff00a9";
			} else if ("negative".equals(dataSourceListBlock1.get(x).get("item_type"))) {
				color = "#159588";

			} else {
				color = "#ffffff";
			}

			for (int j = 0; j < 4; j++) {
				ArrayList<Entry> yValueslog = new ArrayList<Entry>();

				for (int i = 0; i < repititions; i++) {
					// bean.get(0).getYValForXIndex(i);
					// bean.get(j).getYValForXIndex(i);
					// yValueslog.clear();
					// bean.get(j).getYVals().get(i).getVal();
					if (dataListArrayList.get(x).get(j) != null) {
						try {
							yValueslog
									.add(new Entry(
											(float) MathLog.log(
													dataListArrayList.get(x).get(j).getYVals().get(i).getVal(), 10),
											i));
						} catch (Exception e) {
							// TODO: handle exception
						}

					}

				}
				addLineChart(yValueslog, color, 2);
				// dataLista1.add(dataSet);
				dataList.add(dataSet);

			}
			dataListLogSampleArrayList.add(dataList);

		}
		for (int x = 0; x < 16; x++) {

			ArrayList<LineDataSet> dataList = null;
			dataList = new ArrayList<LineDataSet>();
			String color = "";
			if ("sample".equals(dataSourceListBlock2.get(x).get("item_type"))) {
				color = "#ff2d55";
			} else if ("standard".equals(dataSourceListBlock2.get(x).get("item_type"))) {
				color = "#fd9727";
			} else if ("positive".equals(dataSourceListBlock2.get(x).get("item_type"))) {
				color = "#ff00a9";
			} else if ("negative".equals(dataSourceListBlock2.get(x).get("item_type"))) {
				color = "#159588";

			} else {
				color = "#ffffff";
			}

			for (int j = 0; j < 4; j++) {
				ArrayList<Entry> yValueslog = new ArrayList<Entry>();

				for (int i = 0; i < repititions; i++) {
					// bean.get(0).getYValForXIndex(i);
					// bean.get(j).getYValForXIndex(i);
					// yValueslog.clear();
					// bean.get(j).getYVals().get(i).getVal();
					if (dataListArrayList.get(x).get(j) != null) {
						try {
							yValueslog
									.add(new Entry(
											(float) MathLog.log(
													dataListArrayList.get(x).get(j).getYVals().get(i).getVal(), 10),
											i));
						} catch (Exception e) {
							// TODO: handle exception
						}

					}

				}
				addLineChart(yValueslog, color, 2);
				// dataLista1.add(dataSet);
				dataList.add(dataSet);

			}
			dataListLogSampleArrayList.add(dataList);

		}

		dataSets = new ArrayList<LineDataSet>();

		// 将数据加入dataSets
		/*
		 * dataSets.add(dataSet); dataSets.add(dataSet1);
		 * dataSets.add(dataSet2); dataSets.add(dataSet3);
		 * dataSets.add(dataSet4); dataSets.add(dataSet5);
		 * dataSets.add(dataSet6); dataSets.add(dataSet7);
		 */
		dataSet = new LineDataSet(yValues, "");
		// dataSets.add(dataSet);
		// dataSets.remove(dataSet);
		// // 构建一个LineData 将dataSets放入
		// LineData lineData = new LineData(xValues, dataSets);
		//
		// // mLineChart2.setBackgroundColor(Color.BLUE);
		// chart.setGridBackgroundColor(Color.WHITE);
		//
		// // 将数据插入 chart.setData(lineData);
		// Legend mLegend = chart.getLegend();
		// // 设置比例图标示，就是那个一组y的value的 mLegend.setXEntrySpace(7f);
		// mLegend.setYEntrySpace(5f);
		// chart.animateX(0); // 立即执行的动画,x轴
		//
		// // LineData mLineData = getLineData(36, 100);
		// //
		// // showChart(chart, mLineData, Color.rgb(255, 255, 255));
		//
		// // Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
		//
		// // modify the legend ...
		// // mLegend.setPosition(LegendPosition.LEFT_OF_CHART);
		// mLegend.setForm(LegendForm.CIRCLE);// 样式
		// mLegend.setFormSize(0f);// 字体
		// mLegend.setTextColor(Color.WHITE);// 颜色
		ArrayList<Entry> yValue = new ArrayList<Entry>();

		// 模拟第二组组y轴数据(存放y轴数据的是一个Entry的ArrayList) 他是构建LineDataSet的参数之一

		// ArrayList<Entry> yValue1 = new ArrayList<Entry>();

		// Log.e("wing", yValue.size() + "");

		// 构建一个LineDataSet 代表一组Y轴数据 （比如不同的彩票： 七星彩 双色球）

		dataSets = new ArrayList<LineDataSet>();

		// 将数据加入dataSets

		// 构建一个LineData 将dataSets放入
		LineData lineData = new LineData(xValues, dataSets);

		// mLineChart2.setBackgroundColor(Color.BLUE);
		chart.setGridBackgroundColor(Color.WHITE);
		// 将数据插入
		chart.setData(lineData);
		chart.removeAllViews();
		Legend mLegend = chart.getLegend(); // 设置比例图标示，就是那个一组y的value的
		mLegend.setXEntrySpace(7f);
		mLegend.setYEntrySpace(5f);
		mLegend.setForm(LegendForm.SQUARE);// 样式
		mLegend.setFormSize(0f);// 字体
		mLegend.setTextColor(Color.WHITE);// 颜色

		chart.animateX(0); // 立即执行的动画,x轴
	}

	@Override
	public void initDragGridView() {
		int index = 0;

		for (int i = 0; i < 16; i++) {
			HashMap<String, Object> hashMap = new HashMap<String, Object>();
			String item_image = contextString.substring(contextString.indexOf("item_image:", index) + 11,
					contextString.indexOf(",item_text:", index)).trim();
			String item_text = contextString.substring(contextString.indexOf("item_text:", index) + 10,
					contextString.indexOf(",item_selected:", index)).trim();
			Boolean item_selected = Boolean.getBoolean(contextString.substring(
					contextString.indexOf("item_selected:", index) + 14, contextString.indexOf(",item_null:", index)));

			boolean item_null = false;
			if ("null".equals(contextString.substring(contextString.indexOf("item_null:", index) + 10,
					contextString.indexOf(",item_aisle:", index)))) {
				item_null = true;
				hashMap.put("item_null", item_null);
			} else {
				item_null = false;
				hashMap.put("item_null", item_null);
			}
			// = contextString.substring(
			// contextString.indexOf("item_null:", index) + 10,
			// contextString.indexOf(",item_aisle:", index));
			int item_aisle = 0;
			if ("null".equals(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
					contextString.indexOf(",item_type:", index)).trim())) {

			} else {
				item_aisle = Integer.parseInt(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
						contextString.indexOf(",item_type:", index)).trim());
			}

			// String item_type = contextString.substring(
			// contextString.indexOf("item_type:", index) + 11,
			// contextString.indexOf("item_type:", index));

			int nextIndex = contextString.indexOf("item_image:", index) + 11;

			String item_type = "";
			if (i == 15) {
				item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
						contextString.indexOf(",,dataSourceListBlock2", index)).trim();

			} else {
				item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
						contextString.indexOf(",item_image:", nextIndex)).trim();
			}

			// LogUtil.e(item_image);
			// LogUtil.e(item_text);
			// LogUtil.e(item_selected);
			// // LogUtil.e(item_null+"");
			// // LogUtil.e(item_aisle+"");
			// LogUtil.e(item_type);

			hashMap.put("item_image", item_image);
			hashMap.put("item_text", item_text);
			hashMap.put("item_selected", item_selected);

			hashMap.put("item_aisle", item_aisle);
			hashMap.put("item_type", item_type);

			dataSourceListBlock1.add(hashMap);
			index = contextString.indexOf("item_type:", index) + 10;
		}

		for (int i = 0; i < 16; i++) {
			HashMap<String, Object> hashMap = new HashMap<String, Object>();
			String item_image = contextString.substring(contextString.indexOf("item_image:", index) + 11,
					contextString.indexOf(",item_text:", index)).trim();
			String item_text = contextString.substring(contextString.indexOf("item_text:", index) + 10,
					contextString.indexOf(",item_selected:", index)).trim();
			Boolean item_selected = Boolean.getBoolean(contextString.substring(
					contextString.indexOf("item_selected:", index) + 14, contextString.indexOf(",item_null:", index)));

			boolean item_null = false;
			if ("null".equals(contextString.substring(contextString.indexOf("item_null:", index) + 10,
					contextString.indexOf(",item_aisle:", index)))) {
				item_null = true;
				hashMap.put("item_null", item_null);
			} else {
				item_null = false;
				hashMap.put("item_null", item_null);
			}
			// = contextString.substring(
			// contextString.indexOf("item_null:", index) + 10,
			// contextString.indexOf(",item_aisle:", index));
			int item_aisle = 0;
			if ("null".equals(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
					contextString.indexOf(",item_type:", index)).trim())) {

			} else {
				item_aisle = Integer.parseInt(contextString.substring(contextString.indexOf("item_aisle:", index) + 11,
						contextString.indexOf(",item_type:", index)).trim());
			}

			// String item_type = contextString.substring(
			// contextString.indexOf("item_type:", index) + 11,
			// contextString.indexOf("item_type:", index));

			int nextIndex = contextString.indexOf("item_image:", index) + 11;

			String item_type = "";
			if (contextString.indexOf("item_image:", nextIndex) < 0) {

				if ("Absolute Quantitation"
						.equals(SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
						| "绝对定量".equals(SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
								BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,cameraSet", index)).trim();

				} else {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",,endogenousControl", index)).trim();

				}

			} else {
				if (i == 15) {

					// TODO 最后一位不出来颜色bug在这以后再改
					if ("Absolute Quantitation"
							.equals(SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
									BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))
							| "绝对定量".equals(SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
									BaseApplication.BASEINFORMATION_EXPERIMENTTYPE, ""))) {
						item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
								contextString.indexOf(",,cameraSet", index)).trim();

					} else {
						item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
								contextString.indexOf(",,endogenousControl", index)).trim();

					}
					// ByAlert.alert(contextString.substring(
					// contextString.indexOf("item_type:", index) + 10,
					// contextString.length()-1));
				} else {
					item_type = contextString.substring(contextString.indexOf("item_type:", index) + 10,
							contextString.indexOf(",item_image:", nextIndex)).trim();
				}
			}

			// LogUtil.e(item_image);
			// LogUtil.e(item_text);
			// LogUtil.e(item_selected);
			// // LogUtil.e(item_null+"");
			// // LogUtil.e(item_aisle+"");
			// LogUtil.e(item_type);

			hashMap.put("item_image", item_image);
			hashMap.put("item_text", item_text);
			hashMap.put("item_selected", item_selected);

			hashMap.put("item_aisle", item_aisle);
			hashMap.put("item_type", item_type);

			dataSourceListBlock2.add(hashMap);
			index = contextString.indexOf("item_type:", index) + 10;
		}
		// LogUtil.e(dataSourceListBlock2);
		// dataSourceListBlock2.get(15);

		HashSet<Integer> positionsArrayList = new HashSet<Integer>();
		Gson gson = new Gson();
		String json = "";
		json = (String) SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this, "positionsArrayList", "");
		Type type = new TypeToken<HashSet<Integer>>() {
		}.getType();
		if (TextUtils.isEmpty(json)) {

		} else {
			positionsArrayList = gson.fromJson(json, type);
		}
		if (positionsArrayList.size() > 0) {
			for (int i : positionsArrayList) {
				if (i < 16) {
					HashMap<String, Object> hashMap = new HashMap<String, Object>();
					hashMap.put("item_image", "");
					hashMap.put("item_text", "");
					hashMap.put("item_selected", false);

					hashMap.put("item_aisle", 0);
					hashMap.put("item_type", "null");
					dataSourceListBlock1.set(i, hashMap);
				} else {
					HashMap<String, Object> hashMap = new HashMap<String, Object>();
					hashMap.put("item_image", "");
					hashMap.put("item_text", "");
					hashMap.put("item_selected", false);

					hashMap.put("item_aisle", 0);
					hashMap.put("item_type", "null");
					dataSourceListBlock2.set(i - 16, hashMap);
				}

			}
		}

		dataSourceListBlockToShow.addAll(dataSourceListBlock1);

		dragGridViewAdapter = new DragGridViewAdapter(dataSourceListBlockToShow);

		dragGridView.setAdapter(dragGridViewAdapter);

		dragGridView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				if ("block1".equals(blockStr)) {
					if ((Boolean) dataSourceListBlock1.get(position).get("item_selected")) {
						dataSourceListBlock1.get(position).put("item_selected", false);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock1.get(position).get("item_image") + "")) {

								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position).get(0));

												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}

											} else if (spinner2Postion == 2) {
												// 看

												spinner22Util(position, false, 1);

											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {

												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									}

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 2);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 1);
											}

										}
									}
								}
							}
							// 不是不显示
							else {

							}

						}

						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

							} else {
								if (spinner4Postion == 0) {
									if (spinner3Postion == 1) {

										if (spinner2Postion == 0) {
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position).get(0));
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position).get(1));
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position).get(2));
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}
										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListLogArrayList.get(position).get(0));
											dataSets.remove(dataListLogArrayList.get(position).get(1));
											dataSets.remove(dataListLogArrayList.get(position).get(2));
											dataSets.remove(dataListLogArrayList.get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}
										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 1);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
											dataSets.remove(
													amplificationUtil.getDataListDeltaArrayList().get(position).get(0));
											dataSets.remove(
													amplificationUtil.getDataListDeltaArrayList().get(position).get(1));
											dataSets.remove(
													amplificationUtil.getDataListDeltaArrayList().get(position).get(2));
											dataSets.remove(
													amplificationUtil.getDataListDeltaArrayList().get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}
										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListArrayList.get(position).get(0));
											dataSets.remove(dataListArrayList.get(position).get(1));
											dataSets.remove(dataListArrayList.get(position).get(2));
											dataSets.remove(dataListArrayList.get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}
										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 1);
										}

									}
								} else if (spinner4Postion == 1) {
									if (spinner3Postion == 1) {
										if (spinner2Postion == 0) {
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position).get(0));
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position).get(1));
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position).get(2));
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}
										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListLogSampleArrayList.get(position).get(0));
											dataSets.remove(dataListLogSampleArrayList.get(position).get(1));
											dataSets.remove(dataListLogSampleArrayList.get(position).get(2));
											dataSets.remove(dataListLogSampleArrayList.get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}
										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 1);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position).get(0));
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position).get(1));
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position).get(2));
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}
										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListSampleArrayList.get(position).get(0));
											dataSets.remove(dataListSampleArrayList.get(position).get(1));
											dataSets.remove(dataListSampleArrayList.get(position).get(2));
											dataSets.remove(dataListSampleArrayList.get(position).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 2);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 1);
										}

									}
								}

							}

						}
						if (spinner2Postion == 0) {

						}

						if (spinner4Postion == 0) {

						}
						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴

					} else {
						dataSourceListBlock1.get(position).put("item_selected", true);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock1.get(position).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position)
														.get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									}

								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position)
														.get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position)
														.get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(position)
														.get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND1(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 1);
											}

										}
									}
								}
							}
							// 不是不显示
							else {

							}
						}
						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock1.get(position).get("item_aisle")) == 0) {

							} else {

								if (spinner4Postion == 0) {
									if (spinner3Postion == 1) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position)
													// .get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position)
													// .get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(position)
													// .get(3));
//												}
//											}

											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(dataListLogArrayList.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogArrayList.get(position).get(1));
													// dataSets.add(dataListLogArrayList.get(position).get(2));
													// dataSets.add(dataListLogArrayList.get(position).get(3));

//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 1);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(position).get(1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(position).get(2));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(position).get(3));

//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListArrayList.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(dataListArrayList.get(position).get(1));
													// dataSets.add(dataListArrayList.get(position).get(2));
													// dataSets.add(dataListArrayList.get(position).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 1);
										}

									}
								} else if (spinner4Postion == 1) {
									if (spinner3Postion == 1) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(position).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(position).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(position).get(3));

//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(dataListLogSampleArrayList.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogSampleArrayList.get(position).get(1));
													// dataSets.add(dataListLogSampleArrayList.get(position).get(2));
													// dataSets.add(dataListLogSampleArrayList.get(position).get(3));

//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 1);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(position).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(position).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(position).get(3));

//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(dataListSampleArrayList.get(position).get(Integer.parseInt(dataSourceListBlock1.get(position).get("item_aisle")+"")-1));
													// dataSets.add(dataListSampleArrayList.get(position).get(1));
													// dataSets.add(dataListSampleArrayList.get(position).get(2));
													// dataSets.add(dataListSampleArrayList.get(position).get(3));

//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND1ALL(position, 1);
											}
										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 1);
										}

									}
								}

							}

						}

						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴

					}

				} else if ("block2".equals(blockStr)) {
					if ((Boolean) dataSourceListBlock2.get(position).get("item_selected")) {
						dataSourceListBlock2.get(position).put("item_selected", false);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock2.get(position).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(0));

												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									}

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 1) {
												dataSets.remove(dataListSampleArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 2);
												}

											} else if (spinner2Postion == 2) {
												spinner22Util(position, false, 2);
											}

										}
									}
								}
							}
							// 不是不显示
							else {

							}
						}
						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

							} else {

								if (spinner4Postion == 0) {
									if (spinner3Postion == 1) {
										if (spinner2Postion == 0) {
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position + 16).get(0));
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position + 16).get(1));
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position + 16).get(2));
											dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList()
													.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListLogArrayList.get(position + 16).get(0));
											dataSets.remove(dataListLogArrayList.get(position + 16).get(1));
											dataSets.remove(dataListLogArrayList.get(position + 16).get(2));
											dataSets.remove(dataListLogArrayList.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 2);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
											dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
													.get(position + 16).get(0));
											dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
													.get(position + 16).get(1));
											dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
													.get(position + 16).get(2));
											dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
													.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListArrayList.get(position + 16).get(0));
											dataSets.remove(dataListArrayList.get(position + 16).get(1));
											dataSets.remove(dataListArrayList.get(position + 16).get(2));
											dataSets.remove(dataListArrayList.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 2);
										}

									}
								} else if (spinner4Postion == 1) {
									if (spinner3Postion == 1) {
										if (spinner2Postion == 0) {
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position + 16).get(0));
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position + 16).get(1));
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position + 16).get(2));
											dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList()
													.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(0));
											dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(1));
											dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(2));
											dataSets.remove(dataListLogSampleArrayList.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 2);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position + 16).get(0));
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position + 16).get(1));
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position + 16).get(2));
											dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList()
													.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 1) {
											dataSets.remove(dataListSampleArrayList.get(position + 16).get(0));
											dataSets.remove(dataListSampleArrayList.get(position + 16).get(1));
											dataSets.remove(dataListSampleArrayList.get(position + 16).get(2));
											dataSets.remove(dataListSampleArrayList.get(position + 16).get(3));
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 2);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, false, 2);
										}

									}
								}

							}

						}
						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴

					} else {

						dataSourceListBlock2.get(position).put("item_selected", true);

						// 判断点击的位置的和spinner的内容
						// 如果不是all
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							// 判断通道是否是一个。是显示曲线
							// 因为名字可能重复。所以决定用颜色做判断
							if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
									.equals(dataSourceListBlock2.get(position).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 1) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}

											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position + 16).get(0));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									}

								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 2) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position + 16).get(1));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 3) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position + 16).get(2));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									}
								} else if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 4) {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 1) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										} else if (spinner3Postion == 0) {
											if (spinner2Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 1) {
												dataSets.add(dataListSampleArrayList.get(position + 16).get(3));
												if (BLEndCb.isChecked()) {
													addBLEND2(position, 1);
												}
											} else if (spinner2Postion == 2) {
												spinner22Util(position, true, 2);
											}

										}
									}
								}
							}
							// 不是不显示
							else {

							}
						}
						// 如果是all,就所有的4条都显示
						else {
							if (((Integer) dataSourceListBlock2.get(position).get("item_aisle")) == 0) {

							} else {
								if (spinner4Postion == 0) {
									if (spinner3Postion == 1) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(position + 16).get(Integer.parseInt(dataSourceListBlock2.get(position).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
													// .get(position +
													// 16).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
													// .get(position +
													// 16).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
													// .get(position +
													// 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogArrayList.get(position + 16).get(Integer.parseInt(dataSourceListBlock2.get(position).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogArrayList.get(position
													// + 16).get(1));
													// dataSets.add(dataListLogArrayList.get(position
													// + 16).get(2));
													// dataSets.add(dataListLogArrayList.get(position
													// + 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 2);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(position + 16).get(Integer.parseInt(dataSourceListBlock2.get(position).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList()
													// .get(position +
													// 16).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList()
													// .get(position +
													// 16).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList()
													// .get(position +
													// 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListArrayList.get(position + 16).get(Integer.parseInt(dataSourceListBlock2.get(position).get("item_aisle")+"")-1));
													// dataSets.add(dataListArrayList.get(position
													// + 16).get(1));
													// dataSets.add(dataListArrayList.get(position
													// + 16).get(2));
													// dataSets.add(dataListArrayList.get(position
													// + 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 2);
										}

									}
								} else if (spinner4Postion == 1) {
									if (spinner3Postion == 1) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(position + 16).get(Integer.parseInt(dataSourceListBlock2.get(position).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(position +
													// 16).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(position +
													// 16).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(position +
													// 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogSampleArrayList.get(position ).get(Integer.parseInt(dataSourceListBlock2.get(position-16).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogSampleArrayList.get(position
													// + 16).get(1));
													// dataSets.add(dataListLogSampleArrayList.get(position
													// + 16).get(2));
													// dataSets.add(dataListLogSampleArrayList.get(position
													// + 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 2);
										}

									} else if (spinner3Postion == 0) {
										if (spinner2Postion == 0) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(position + 16).get(Integer.parseInt(dataSourceListBlock2.get(position).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(position +
													// 16).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(position +
													// 16).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(position +
													// 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 1) {
//											for (int i = 0; i < 4; i++) {
//												if (i == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListSampleArrayList.get(position + 16).get(Integer.parseInt(dataSourceListBlock2.get(position).get("item_aisle")+"")-1));
													// dataSets.add(dataListSampleArrayList.get(position
													// + 16).get(1));
													// dataSets.add(dataListSampleArrayList.get(position
													// + 16).get(2));
													// dataSets.add(dataListSampleArrayList.get(position
													// + 16).get(3));
//												}
//											}
											if (BLEndCb.isChecked()) {
												addBLEND2ALL(position, 1);
											}

										} else if (spinner2Postion == 2) {
											spinner22Util(position, true, 2);
										}

									}
								}

							}

						}
						LineData lineData = new LineData(xValues, dataSets);

						// mLineChart2.setBackgroundColor(Color.BLUE);
						chart.setGridBackgroundColor(Color.WHITE);
						// 将数据插入
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴

					}
				}

				dragGridViewAdapter.notifyDataSetChanged();
			}

		});

		block1Btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				blockUpTv.setText("A");
				blockDownTv.setText("B");

				block1Btn.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
				block2Btn.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));

				dataSourceListBlockToShow.clear();
				dataSourceListBlockToShow.addAll(dataSourceListBlock1);
				dragGridViewAdapter.notifyDataSetChanged();

				blockStr = "block1";
			}
		});
		block2Btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				blockUpTv.setText("C");
				blockDownTv.setText("D");

				block1Btn.setBackground(getResources().getDrawable(R.drawable.shape_blackframe));
				block2Btn.setBackground(getResources().getDrawable(R.drawable.shape_darkblueblackframe));
				dataSourceListBlockToShow.clear();
				dataSourceListBlockToShow.addAll(dataSourceListBlock2);
				dragGridViewAdapter.notifyDataSetChanged();

				blockStr = "block2";
			}
		});

	}

	@Override
	public void initSpinnerView() {

		// layoutOne的数据解析
		activityLayoutTableBeans = new ArrayList<LayoutTableBean>();

		// LogUtil.e(contextString.indexOf(",Aisle") + 7);
		// LogUtil.e(contextString.indexOf(",Color"));

		int index = 0;
		while (!(contextString.indexOf("Aisle", index) <= 0)) {

			// Aisle:
			String aisle;
			aisle = contextString.substring(contextString.indexOf(",Aisle", index) + 7,

					contextString.indexOf(",Color", index));
					// LogUtil.e(aisle);

			// Color
			String color;
			color = contextString.substring(contextString.indexOf(",Color", index) + 7,

					contextString.indexOf(",Target", index));
					// LogUtil.e(color);

			// Target
			String target;
			target = contextString.substring(contextString.indexOf(",Target", index) + 8,

					contextString.indexOf(",Dyes", index));

			// LogUtil.e(target);

			int nextIndex = contextString.indexOf(",Aisle", index) + 7;

			// Dyes
			String dyes;
			if (contextString.indexOf(",Aisle", nextIndex) < 0) {

				dyes = contextString.substring(contextString.indexOf(",Dyes", index) + 6,
						contextString.indexOf(",,dataSourceListBlock1", index));

				// LogUtil.e(dyes);
			} else {

				dyes = contextString.substring(contextString.indexOf(",Dyes", index) + 6,

						contextString.indexOf(",Aisle", nextIndex));
				// LogUtil.e(dyes);
			}

			index = contextString.indexOf(",Dyes", index) + 5;

			activityLayoutTableBeans.add(new LayoutTableBean(false, Integer.parseInt(aisle.trim()),
					Integer.parseInt(color.trim()), target, dyes));

		}

		// 第一个下拉菜单的数据
		data_list1 = new ArrayList<String>();
		for (LayoutTableBean bean : activityLayoutTableBeans) {
			data_list1.add(bean.getTarget());
		}
		data_list1.add("All");
		// 适配器
		arr_adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data_list1);
		// 设置样式
		arr_adapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

		// 第二个下拉菜单的数据
		data_list2 = new ArrayList<String>();
		data_list2.add("△Rn vs Cycle");
		data_list2.add("Rn vs Cycle");
		data_list2.add("Ct vs Well");

		// 适配器
		arr_adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data_list2);
		// 设置样式
		arr_adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		// 第三个下拉菜单的数据
		data_list3 = new ArrayList<String>();
		data_list3.add("Linear");
		data_list3.add("Log");

		// 适配器
		arr_adapter3 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data_list3);
		// 设置样式
		arr_adapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

		// 地四个下拉菜单数据
		data_list4 = new ArrayList<String>();
		data_list4.add("Target");
		data_list4.add("Sample");
		// 适配器
		arr_adapter4 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, data_list4);
		// 设置样式
		arr_adapter4.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

		// 设置三个Spinner
		spinner1.setAdapter(arr_adapter1);
		spinner1.setSelection(data_list1.size() - 1, true);
		spinner1Postion = data_list1.size() - 1;
		spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) {

				spinner1Postion = position;
				pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", false, false);
				for (LineDataSet line : lineDataSets) {
					dataSets.remove(line);
				}
				final Handler handler = new Handler();
				new Thread() {
					public void run() {

						handler.post(runnableUi);
					}
				}.start();

				// new Thread() {
				// public void run() {
				// }
				// }.start();

			}

			@Override
			public void onNothingSelected(AdapterView<?> parent) {
				// TODO Auto-generated method stub

			}
		});

		spinner2.setAdapter(arr_adapter2);
		spinner2.setSelection(0, true);

		spinner3.setAdapter(arr_adapter3);
		spinner3.setSelection(0, true);

		spinner4.setAdapter(arr_adapter4);
		spinner4.setSelection(0, true);

		spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
				spinner2Postion = position;
				Legend mLegend;
				LineData lineData;

				for (int i = 0; i < 32; i++) {
					for (int j = 0; j < 4; j++) {
						dataSets.remove(amplificationUtil.getDataListDeltaArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(j));
						dataSets.remove(dataListArrayList.get(i).get(j));
						dataSets.remove(dataListLogArrayList.get(i).get(j));
						dataSets.remove(dataListSampleArrayList.get(i).get(j));
						dataSets.remove(dataListLogSampleArrayList.get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListCTArrayList().get(i));

					}

				}

				// 删除
				ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
				for (int i = (dataSets.size() - 1); i >= 0; i--) {
					if (dataSets.get(i).getYVals().size() == 1) {
						intsArrayList.add(i);
					}

				}
				for (int i = 0; i < intsArrayList.size(); i++) {
					dataSets.remove((int) intsArrayList.get(i));
				}

				if (spinner2Postion == 0) {
					spinner3.setEnabled(true);
					spinner4.setEnabled(true);
					// 分两个基因盘数据分别遍历
					for (int i = 0; i < 16; i++) {
						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// 判断点击的位置的和spinner的内容
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								// 判断通道是否是一个。是显示曲线
								// 因为名字可能重复。所以决定用颜色做判断
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
									if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {

										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(
														amplificationUtil.getDataListDeltaArrayList().get(i).get(0));

												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(
															amplificationUtil.getDataListDeltaArrayList().get(i).get(0),
															i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(
														amplificationUtil.getDataListDeltaLogArrayList().get(i).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i).get(0), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i)
														.get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i).get(0), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i).get(0), i, 1);
												}

											}
										}

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(
														amplificationUtil.getDataListDeltaArrayList().get(i).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(
															amplificationUtil.getDataListDeltaArrayList().get(i).get(1),
															i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(
														amplificationUtil.getDataListDeltaLogArrayList().get(i).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i).get(1), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i)
														.get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i).get(1), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i).get(1), i, 1);
												}

											}
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(
														amplificationUtil.getDataListDeltaArrayList().get(i).get(2));

												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(
															amplificationUtil.getDataListDeltaArrayList().get(i).get(2),
															i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(
														amplificationUtil.getDataListDeltaLogArrayList().get(i).get(2));

												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i).get(2), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i)
														.get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i).get(2), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i).get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i).get(2), i, 1);
												}

											}
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(
														amplificationUtil.getDataListDeltaArrayList().get(i).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(
															amplificationUtil.getDataListDeltaArrayList().get(i).get(3),
															i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(
														amplificationUtil.getDataListDeltaLogArrayList().get(i).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i).get(3), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i)
														.get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i).get(3), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i).get(3), i, 1);
												}

											}
										}
									}
								}
								// 不是不显示
								else {

								}
							}
							// 如果是all,就所有的4条都显示
							else {
								if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

								} else {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 0) {

//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i)
															.get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(amplificationUtil
																.getDataListDeltaArrayList().get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1), i, 2);
													}
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaArrayList().get(i).get(1),
													// i, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaArrayList().get(i).get(2),
													// i, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaArrayList().get(i).get(3),
													// i, 2);
//												}
//
//											}

										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(2));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(amplificationUtil
																.getDataListDeltaLogArrayList().get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1), i, 2);
													}
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(1),
													// i,
													// 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(2),
													// i,
													// 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(3),
													// i,
													// 2);
//												}
//											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 0) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.remove(amplificationUtil.getDataListDeltaArrayList().get(i)
															.get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.remove(
													// amplificationUtil.getDataListDeltaArrayList().get(i).get(1));
													// dataSets.remove(
													// amplificationUtil.getDataListDeltaArrayList().get(i).get(2));
													// dataSets.remove(
													// amplificationUtil.getDataListDeltaArrayList().get(i).get(3));

													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(2));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(amplificationUtil
																.getDataListDeltaSampleArrayList().get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1), i, 2);
													}
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(1),
													// i, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(2),
													// i, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(3),
													// i, 2);
//												}
//											}
										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i)
													// .get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i)
													// .get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i)
													// .get(3));
													if (BLEndCb.isChecked()) {
														spinner2AddBaseSTEND(amplificationUtil
																.getDataListDeltaLogSampleArrayList().get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1), i,
																2);

													}
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i).get(1), i, 2);
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i).get(2), i, 2);
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i).get(3), i, 2);
//												}
//											}
										}
									}

								}

							}
						}

						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

							// 判断点击的位置的和spinner的内容
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								// 判断通道是否是一个。是显示曲线
								// 因为名字可能重复。所以决定用颜色做判断
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
									// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
									if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {

										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i + 16)
														.get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(0), i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(i + 16).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i + 16).get(0), i + 16,
															1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(i + 16).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i + 16).get(0),
															i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i + 16).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i + 16).get(0),
															i + 16, 1);
												}

											}
										}

									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i + 16)
														.get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(1), i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(i + 16).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i + 16).get(1), i + 16,
															1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(i + 16).get(1));

												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i + 16).get(1),
															i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i + 16).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i + 16).get(1),
															i + 16, 1);
												}

											}
										}
									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i + 16)
														.get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(2), i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(i + 16).get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i + 16).get(2), i + 16,
															1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(i + 16).get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i + 16).get(2),
															i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i + 16).get(2));

												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i + 16).get(2),
															i + 16, 1);
												}

											}
										}
									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i + 16)
														.get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(3), i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
														.get(i + 16).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogArrayList().get(i + 16).get(3), i + 16,
															1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
														.get(i + 16).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaSampleArrayList().get(i + 16).get(3),
															i + 16, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
														.get(i + 16).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(amplificationUtil
															.getDataListDeltaLogSampleArrayList().get(i + 16).get(3),
															i + 16, 1);
												}

											}
										}
									}
								}
								// 不是不显示
								else {

								}
							}
							// 如果是all,就所有的4条都显示
							else {
								if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

								} else {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 0) {

//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(2));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(amplificationUtil
																.getDataListDeltaArrayList().get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1), i + 16,
																2);
													}
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(1),
													// i + 16, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(2),
													// i + 16, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(3),
													// i + 16, 2);
//												}
//											}
										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16)
													// .get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16)
													// .get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16)
													// .get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(amplificationUtil
																.getDataListDeltaLogArrayList().get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1),
																i + 16, 2);
													}
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16).get(1),
													// i + 16, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16).get(2),
													// i + 16, 2);
													// spinner2AddBaseSTEND(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16).get(3),
													// i + 16, 2);
//												}
//											}

										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 0) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.remove(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.remove(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(1));
													// dataSets.remove(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(2));
													// dataSets.remove(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(3));

													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i
													// + 16)
													// .get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i
													// + 16)
													// .get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i
													// + 16)
													// .get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(amplificationUtil
																.getDataListDeltaSampleArrayList().get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1),
																i + 16, 2);
													}
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(i + 16).get(1), i +
													// 16, 2);
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(i + 16).get(2), i +
													// 16, 2);
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaSampleArrayList()
													// .get(i + 16).get(3), i +
													// 16, 2);
//												}
//											}

										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(
																amplificationUtil.getDataListDeltaLogSampleArrayList()
																		.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1),
																i + 16, 2);
													}
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(1), i +
													// 16, 2);
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(2), i +
													// 16, 2);
													// spinner2AddBaseSTEND(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(3), i +
													// 16, 2);
//												}
//											}
										}
									}

								}

							}

						}

					}
					xValues = new ArrayList<String>();
					for (int i = 1; i < repititions + 2; i++) {
						xValues.add(i + "");
					}

				} else if (spinner2Postion == 1) {

					spinner3.setEnabled(true);
					spinner4.setEnabled(true);

					// 分两个基因盘数据分别遍历
					for (int i = 0; i < 16; i++) {

						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// 判断点击的位置的和spinner的内容
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								// 判断通道是否是一个。是显示曲线
								// 因为名字可能重复。所以决定用颜色做判断
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
									if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {

										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListArrayList.get(i).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListArrayList.get(i).get(0), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(0), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListSampleArrayList.get(i).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(0), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(i).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(0), i,
															1);
												}

											}
										}

									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListArrayList.get(i).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListArrayList.get(i).get(1), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(1), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListSampleArrayList.get(i).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(1), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(i).get(1));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(1), i,
															1);
												}

											}
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListArrayList.get(i).get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListArrayList.get(i).get(2), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i).get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(2), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListSampleArrayList.get(i).get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(2), i, 1);
												}

											} else if (spinner3Postion == 1) {

												dataSets.add(dataListLogSampleArrayList.get(i).get(2));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(2), i,
															1);
												}

											}
										}
									} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListArrayList.get(i).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListArrayList.get(i).get(3), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(3), i, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListSampleArrayList.get(i).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(3), i, 1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(i).get(3));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(3), i,
															1);
												}

											}
										}
									}
								}
								// 不是不显示
								else {

								}
							}
							// 如果是all,就所有的4条都显示
							else {
								if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

								} else {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 0) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListArrayList.get(i).get(1));
													// dataSets.add(dataListArrayList.get(i).get(2));
													// dataSets.add(dataListArrayList.get(i).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(dataListArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1), i, 2);
													}
													// spinner2AddBaseSTEND(dataListArrayList.get(i).get(1),
													// i, 2);
													// spinner2AddBaseSTEND(dataListArrayList.get(i).get(2),
													// i, 2);
													// spinner2AddBaseSTEND(dataListArrayList.get(i).get(3),
													// i, 2);
//												}
//											}
										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogArrayList.get(i).get(1));
													// dataSets.add(dataListLogArrayList.get(i).get(2));
													// dataSets.add(dataListLogArrayList.get(i).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1), i, 2);
													}
													// spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(1),
													// i, 2);
													// spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(2),
													// i, 2);
													// spinner2AddBaseSTEND(dataListLogArrayList.get(i).get(3),
													// i, 2);
//												}
//											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 0) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListSampleArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListSampleArrayList.get(i).get(1));
													// dataSets.add(dataListSampleArrayList.get(i).get(2));
													// dataSets.add(dataListSampleArrayList.get(i).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1), i,
																2);
													}
													// spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(1),
													// i, 2);
													// spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(2),
													// i, 2);
													// spinner2AddBaseSTEND(dataListSampleArrayList.get(i).get(3),
													// i, 2);
//												}
//											}
										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogSampleArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogSampleArrayList.get(i).get(1));
													// dataSets.add(dataListLogSampleArrayList.get(i).get(2));
													// dataSets.add(dataListLogSampleArrayList.get(i).get(3));
													if (BLEndCb.isChecked()) {

														spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1),
																i, 2);
													}
													// spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(1),
													// i, 2);
													// spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(2),
													// i, 2);
													// spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i).get(3),
													// i, 2);
//												}
//											}

										}
									}

								}

							}
						}

						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

							// 判断点击的位置的和spinner的内容
							// 如果不是all
							if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
								// 判断通道是否是一个。是显示曲线
								// 因为名字可能重复。所以决定用颜色做判断
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
									// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
									if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {

										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListArrayList.get(i + 16).get(0));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListArrayList.get(i + 16).get(0), i + 16,
															1);
												} else {

												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i + 16).get(0));
												if (BLEndCb.isChecked()) {

													spinner2AddBaseSTEND(dataListLogArrayList.get(i + 16).get(0),
															i + 16, 1);
												}
											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListSampleArrayList.get(i + 16).get(0));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListSampleArrayList.get(i + 16).get(0),
															i + 16, 1);
												}
											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(i + 16).get(0));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i + 16).get(0),
															i + 16, 1);
												}
											}
										}

									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListArrayList.get(i + 16).get(1));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListArrayList.get(i + 16).get(1), i + 16,
															1);
												}

											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i + 16).get(1));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListLogArrayList.get(i + 16).get(1),
															i + 16, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {

												dataSets.add(dataListSampleArrayList.get(i + 16).get(1));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListSampleArrayList.get(i + 16).get(1),
															i + 16, 1);
												}
											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(i + 16).get(1));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i + 16).get(1),
															i + 16, 1);
												}
											}
										}
									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListArrayList.get(i + 16).get(2));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListArrayList.get(i + 16).get(2), i + 16,
															1);
												}
											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i + 16).get(2));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListLogArrayList.get(i + 16).get(2),
															i + 16, 1);
												}

											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListSampleArrayList.get(i + 16).get(2));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListSampleArrayList.get(i + 16).get(2),
															i + 16, 1);
												}
											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(i + 16).get(2));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i + 16).get(2),
															i + 16, 1);
												}
											}
										}
									} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
										if (spinner4Postion == 0) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListArrayList.get(i + 16).get(3));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListArrayList.get(i + 16).get(3), i + 16,
															1);
												}
											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogArrayList.get(i + 16).get(3));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListLogArrayList.get(i + 16).get(3),
															i + 16, 1);
												}
											}
										} else if (spinner4Postion == 1) {
											if (spinner3Postion == 0) {
												dataSets.add(dataListSampleArrayList.get(i + 16).get(3));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListSampleArrayList.get(i + 16).get(3),
															i + 16, 1);
												}
											} else if (spinner3Postion == 1) {
												dataSets.add(dataListLogSampleArrayList.get(i + 16).get(3));
												if (BLEndCb.isChecked()) {
													spinner2AddBaseSTEND(dataListLogSampleArrayList.get(i + 16).get(3),
															i + 16, 1);
												}
											}
										}
									}
								}
								// 不是不显示
								else {

								}
							}
							// 如果是all,就所有的4条都显示
							else {
								if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

								} else {
									if (spinner4Postion == 0) {
										if (spinner3Postion == 0) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListArrayList.get(i
													// + 16).get(3));
													if (BLEndCb.isChecked()) {
														spinner2AddBaseSTEND(dataListArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1),
																i + 16, 2);
														// spinner2AddBaseSTEND(dataListArrayList.get(i
														// + 16).get(1),
														// i + 16, 2);
														// spinner2AddBaseSTEND(dataListArrayList.get(i
														// + 16).get(2),
														// i + 16, 2);
														// spinner2AddBaseSTEND(dataListArrayList.get(i
														// + 16).get(3),
														// i + 16, 2);
//													}
//												}
											}

										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListLogArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListLogArrayList.get(i
													// + 16).get(3));
													if (BLEndCb.isChecked()) {
														spinner2AddBaseSTEND(dataListLogArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1), i,
																2);
														// spinner2AddBaseSTEND(dataListLogArrayList.get(i
														// + 16).get(1), i,
														// 2);
														// spinner2AddBaseSTEND(dataListLogArrayList.get(i
														// + 16).get(2), i,
														// 2);
														//
														// spinner2AddBaseSTEND(dataListLogArrayList.get(i
														// + 16).get(3), i,
														// 2);
//													}
//												}
											}
										}
									} else if (spinner4Postion == 1) {
										if (spinner3Postion == 0) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListSampleArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListSampleArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListSampleArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListSampleArrayList.get(i
													// + 16).get(3));
													if (BLEndCb.isChecked()) {
														spinner2AddBaseSTEND(dataListSampleArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1),
																i + 16, 2);
														// spinner2AddBaseSTEND(dataListSampleArrayList.get(i
														// + 16).get(1), i + 16,
														// 2);
														// spinner2AddBaseSTEND(dataListSampleArrayList.get(i
														// + 16).get(2), i + 16,
														// 2);
														// spinner2AddBaseSTEND(dataListSampleArrayList.get(i
														// + 16).get(3), i + 16,
														// 2);
//													}
//												}
											}
										} else if (spinner3Postion == 1) {
//											for (int k = 0; k < 4; k++) {
//												if (k == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogSampleArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogSampleArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListLogSampleArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListLogSampleArrayList.get(i
													// + 16).get(3));
													if (BLEndCb.isChecked()) {
														spinner2AddBaseSTEND(
																dataListLogSampleArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1), i + 16,
																2);
														// spinner2AddBaseSTEND(
														// dataListLogSampleArrayList.get(i
														// + 16).get(1), i + 16,
														// 2);
														// spinner2AddBaseSTEND(
														// dataListLogSampleArrayList.get(i
														// + 16).get(2), i + 16,
														// 2);
														// spinner2AddBaseSTEND(
														// dataListLogSampleArrayList.get(i
														// + 16).get(3), i + 16,
														// 2);
//													}
//												}
											}
										}
									}

								}

							}

						}

					}
					xValues = new ArrayList<String>();
					for (int i = 1; i < repititions + 2; i++) {
						xValues.add(i + "");
					}

				} else if (spinner2Postion == 2) {
					// spinner3选择line 然后不能使用
					spinner3.setEnabled(false);
					spinner4.setEnabled(false);
					// spinner3.setSelection(0, true);
					// spinner4.setSelection(0, true);

					for (int i = 0; i < 16; i++) {
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {

								//
								// if (spinner4Postion == 0) {
								//
								//
								// } else if (spinner4Postion == 1) {
								//
								// }

								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									if (!TextUtils.isEmpty(dataSourceListBlock1.get(i).get("item_image") + "")) {

										if (amplificationUtil.getDataListCTArrayList().get(i) != null) {
											dataSets.add(amplificationUtil.getDataListCTArrayList().get(i));
										}
									}
								}

							}
						} else {
							// all
							// if (spinner4Postion == 0) {

							if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {

								if (!TextUtils.isEmpty(dataSourceListBlock1.get(i).get("item_image") + "")) {

									if (amplificationUtil.getDataListCTArrayList().get(i) != null) {
										dataSets.add(amplificationUtil.getDataListCTArrayList().get(i));
									}
								}
							}

							// } else if (spinner4Postion == 1) {
							//
							// }
						}
						if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
							if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

								//
								// if (spinner4Postion == 0) {
								//
								// } else if (spinner4Postion == 1) {
								//
								// }
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
									if (!TextUtils.isEmpty(dataSourceListBlock2.get(i).get("item_image") + "")) {

										if (amplificationUtil.getDataListCTArrayList().get(i + 16) != null) {
											dataSets.add(amplificationUtil.getDataListCTArrayList().get(i + 16));
										}
									}
								}

							}
						} else {
							// all
							// if (spinner4Postion == 0) {
							if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {

								if (!TextUtils.isEmpty(dataSourceListBlock2.get(i).get("item_image") + "")) {

									if (amplificationUtil.getDataListCTArrayList().get(i + 16) != null) {
										dataSets.add(amplificationUtil.getDataListCTArrayList().get(i + 16));
									}
								}
							}

							// } else if (spinner4Postion == 1) {
							//
							// }
						}

					}
					xValues = new ArrayList<String>();
					for (int i = 1; i <= 32; i++) {
						xValues.add(i + "");
					}

				}

				lineData = new LineData(xValues, dataSets);

				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);
				chart.animateX(0); // 立即执行的动画,x轴

			}

			private void spinner2AddBaseSTEND(LineDataSet lineDataSet, int i, int type) {

				if (type == 1) {
					if (amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName()
							.equals(data_list1.get(spinner1Postion))) {
						float fStart = lineDataSet.getYValForXIndex(
								Integer.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
										- 1);
						float fEnd = lineDataSet.getYValForXIndex((Integer
								.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()))
								- 1);
						dataSets.add(createStartPoint(fStart, Integer
								.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())));
						dataSets.add(createEndPoint(fEnd, Integer
								.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString())));
					}
				} else if (type == 2) {
					float fStart = lineDataSet.getYValForXIndex(
							Integer.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
									- 1);
					float fEnd = lineDataSet.getYValForXIndex((Integer
							.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString())) - 1);
					dataSets.add(createStartPoint(fStart,
							Integer.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())));
					dataSets.add(createEndPoint(fEnd, Integer
							.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString())));
				}

			}

			@Override
			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub

			}
		});
		spinner3.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {

				spinner3Postion = position;
				Legend mLegend;
				LineData lineData;
				for (int i = 0; i < 32; i++) {
					for (int j = 0; j < 4; j++) {
						dataSets.remove(amplificationUtil.getDataListDeltaArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(j));
						dataSets.remove(dataListArrayList.get(i).get(j));
						dataSets.remove(dataListLogArrayList.get(i).get(j));
						dataSets.remove(dataListSampleArrayList.get(i).get(j));
						dataSets.remove(dataListLogSampleArrayList.get(i).get(j));

					}

				}

				ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
				for (int i = (dataSets.size() - 1); i >= 0; i--) {
					if (dataSets.get(i).getYVals().size() == 1) {
						intsArrayList.add(i);
					}

				}
				for (int i = 0; i < intsArrayList.size(); i++) {
					dataSets.remove((int) intsArrayList.get(i));
				}

				if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
					if (spinner3Postion == 0) {

						if (spinner2Postion == 0) {

							if (spinner4Postion == 0) {

								spinner3Util(amplificationUtil.getDataListDeltaArrayList());
								if (BLEndCb.isChecked()) {
									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaArrayList(),
											Integer.parseInt(passReferenceNum) - 1);

								}

							} else if (spinner4Postion == 1) {

								spinner3Util(amplificationUtil.getDataListDeltaSampleArrayList());
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaSampleArrayList(),
											Integer.parseInt(passReferenceNum) - 1);
								}

							}

						} else if (spinner2Postion == 1) {
							if (spinner4Postion == 0) {

								spinner3Util(dataListArrayList);
								if (BLEndCb.isChecked()) {
									spinner3BaseStaEnd(dataListArrayList, Integer.parseInt(passReferenceNum) - 1);

								}

							} else if (spinner4Postion == 1) {

								spinner3Util(dataListSampleArrayList);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(dataListSampleArrayList, Integer.parseInt(passReferenceNum) - 1);
								}

							}

						} else if (spinner2Postion == 2) {
							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}

						}

					} else if (spinner3Postion == 1) {
						if (spinner2Postion == 0) {

							if (spinner4Postion == 0) {

								spinner3Util(amplificationUtil.getDataListDeltaLogArrayList());
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaLogArrayList(),
											Integer.parseInt(passReferenceNum) - 1);
								}

							} else if (spinner4Postion == 1) {

								spinner3Util(amplificationUtil.getDataListDeltaLogSampleArrayList());
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaLogSampleArrayList(),
											Integer.parseInt(passReferenceNum) - 1);
								}

							}

						} else if (spinner2Postion == 1) {
							if (spinner4Postion == 0) {

								spinner3Util(dataListLogArrayList);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(dataListLogArrayList, Integer.parseInt(passReferenceNum) - 1);
								}

							} else if (spinner4Postion == 1) {

								spinner3Util(dataListLogSampleArrayList);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(dataListLogSampleArrayList,
											Integer.parseInt(passReferenceNum) - 1);
								}

							}

						} else if (spinner2Postion == 2) {
							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}

						}
					}
				} else {
					// All
					if (spinner3Postion == 0) {

						if (spinner2Postion == 0) {

							if (spinner4Postion == 0) {

								spinner3AllUtil(amplificationUtil.getDataListDeltaArrayList(),
										Integer.parseInt(passReferenceNum) - 1);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaArrayList(),
											Integer.parseInt(passReferenceNum) - 1);
								}

							} else if (spinner4Postion == 1) {
								spinner3AllUtil(amplificationUtil.getDataListDeltaSampleArrayList(),
										Integer.parseInt(passReferenceNum) - 1);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaSampleArrayList(),
											Integer.parseInt(passReferenceNum) - 1);
								}

							}

						} else if (spinner2Postion == 1) {
							if (spinner4Postion == 0) {
								spinner3AllUtil(dataListArrayList, Integer.parseInt(passReferenceNum) - 1);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(dataListArrayList, Integer.parseInt(passReferenceNum) - 1);
								}
							} else if (spinner4Postion == 1) {
								spinner3AllUtil(dataListSampleArrayList, Integer.parseInt(passReferenceNum) - 1);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(dataListSampleArrayList, Integer.parseInt(passReferenceNum) - 1);
								}
							}

						} else if (spinner2Postion == 2) {
							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}

						}

					} else if (spinner3Postion == 1) {
						if (spinner2Postion == 0) {

							if (spinner4Postion == 0) {
								spinner3AllUtil(amplificationUtil.getDataListDeltaLogArrayList(),
										Integer.parseInt(passReferenceNum) - 1);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaLogArrayList(),
											Integer.parseInt(passReferenceNum) - 1);
								}

							} else if (spinner4Postion == 1) {
								spinner3AllUtil(amplificationUtil.getDataListDeltaLogSampleArrayList(),
										Integer.parseInt(passReferenceNum) - 1);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(amplificationUtil.getDataListDeltaLogSampleArrayList(),
											Integer.parseInt(passReferenceNum) - 1);
								}
							}

						} else if (spinner2Postion == 1) {
							if (spinner4Postion == 0) {
								spinner3AllUtil(dataListLogArrayList, Integer.parseInt(passReferenceNum) - 1);
								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(dataListLogArrayList, Integer.parseInt(passReferenceNum) - 1);
								}
							} else if (spinner4Postion == 1) {
								spinner3AllUtil(dataListLogSampleArrayList, Integer.parseInt(passReferenceNum) - 1);

								if (BLEndCb.isChecked()) {

									spinner3BaseStaEnd(dataListLogSampleArrayList,
											Integer.parseInt(passReferenceNum) - 1);
								}
							}

						} else if (spinner2Postion == 2) {
							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}

						}
					}
				}

				lineData = new LineData(xValues, dataSets);

				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);
				chart.animateX(0); // 立即执行的动画,x轴

			}

			private void spinner3BaseStaEnd(ArrayList<ArrayList<LineDataSet>> dataArrayList, int passreferInt) {
				// 分两个基因盘数据分别遍历
				for (int i = 0; i < 16; i++) {

					if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
						for (int j = 0; j < 4; j++) {
							if (j != passreferInt) {
								if (!TextUtils.isEmpty(dataSourceListBlock1.get(i).get("item_image") + "")) {

									float fStart = dataArrayList.get(i).get(j).getYValForXIndex(Integer.parseInt(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()) - 1);
									float fEnd = dataArrayList.get(i).get(j).getYValForXIndex((Integer.parseInt(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()))
											- 1);

									if (fStart != 0 && fEnd != 0) {
										dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
												.getAdvancedSettingBeans().get(i).getBaselineStart())));
										dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
												.getAdvancedSettingBeans().get(i).getBaselineEndString())));
									}
								}
							}

						}

						// dataSets.add(dataArrayList.get(i).get(0));
						// dataSets.add(dataArrayList.get(i).get(1));
						// dataSets.add(dataArrayList.get(i).get(2));
						// dataSets.add(dataArrayList.get(i).get(3));
					}

					if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {
						for (int j = 0; j < 4; j++) {
							if (j != passreferInt) {
								if (!TextUtils.isEmpty(dataSourceListBlock2.get(i).get("item_image") + "")) {

									float fStart = dataArrayList.get(i + 16).get(j).getYValForXIndex(Integer.parseInt(
											amplificationUtil.getAdvancedSettingBeans().get(i + 16).getBaselineStart())
											- 1);
									float fEnd = dataArrayList.get(i + 16).get(j).getYValForXIndex(
											(Integer.parseInt(amplificationUtil.getAdvancedSettingBeans().get(i + 16)
													.getBaselineEndString())) - 1);

									if (fStart != 0 && fEnd != 0) {
										dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
												.getAdvancedSettingBeans().get(i + 16).getBaselineStart())));
										dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
												.getAdvancedSettingBeans().get(i + 16).getBaselineEndString())));
									}
								}
							}

						}

						// dataSets.add(dataArrayList.get(i).get(0));
						// dataSets.add(dataArrayList.get(i).get(1));
						// dataSets.add(dataArrayList.get(i).get(2));
						// dataSets.add(dataArrayList.get(i).get(3));
					}
				}

			}

			private void spinner3AllUtil(ArrayList<ArrayList<LineDataSet>> arrayList, int passrefereceInt) {
				// 分两个基因盘数据分别遍历
				for (int i = 0; i < 16; i++) {

					if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
//						for (int j = 0; j < 4; j++) {
//							if (j != passrefereceInt) {
								if (!TextUtils.isEmpty(dataSourceListBlock1.get(i).get("item_image") + "")) {

									dataSets.add(arrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
								}
								// dataSets.add(arrayList.get(i).get(1));
								// dataSets.add(arrayList.get(i).get(2));
								// dataSets.add(arrayList.get(i).get(3));

//							}
//						}
					}

					if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {
//						for (int j = 0; j < 4; j++) {
//							if (i != passrefereceInt) {
								if (!TextUtils.isEmpty(dataSourceListBlock2.get(i).get("item_image") + "")) {

									dataSets.add(arrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
								}
							}
							// dataSets.add(arrayList.get(i + 16).get(1));
							// dataSets.add(arrayList.get(i + 16).get(2));
							// dataSets.add(arrayList.get(i + 16).get(3));
//						}
//					}
				}

			}

			private void spinner3Util(ArrayList<ArrayList<LineDataSet>> arrayList) {
				// 分两个基因盘数据分别遍历
				for (int i = 0; i < 16; i++) {
					if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
						// 判断通道是否是一个。是显示曲线
						// 因为名字可能重复。所以决定用颜色做判断
						if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
								.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {

							// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
							if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

							} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
								dataSets.add(arrayList.get(i).get(0));
							} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
								dataSets.add(arrayList.get(i).get(1));
							} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
								dataSets.add(arrayList.get(i).get(2));
							} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
								dataSets.add(arrayList.get(i).get(3));
							}

						}

					}

					if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {
						// 判断通道是否是一个。是显示曲线
						// 因为名字可能重复。所以决定用颜色做判断
						if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
								.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {

							// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
							if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

							} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
								dataSets.add(arrayList.get(i + 16).get(0));
							} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
								dataSets.add(arrayList.get(i + 16).get(1));
							} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
								dataSets.add(arrayList.get(i + 16).get(2));
							} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
								dataSets.add(arrayList.get(i + 16).get(3));
							}

						}

					}
				}

			}

			@Override
			public void onNothingSelected(AdapterView<?> arg0) {

			}
		});
		spinner4.setOnItemSelectedListener(new OnItemSelectedListener() {

			@Override
			public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
				spinner4Postion = position;
				Legend mLegend;
				LineData lineData;

				// 先删除
				for (int i = 0; i < 32; i++) {
					for (int j = 0; j < 4; j++) {
						dataSets.remove(amplificationUtil.getDataListDeltaArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i).get(j));
						dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(j));
						dataSets.remove(dataListArrayList.get(i).get(j));
						dataSets.remove(dataListLogArrayList.get(i).get(j));
						dataSets.remove(dataListSampleArrayList.get(i).get(j));
						dataSets.remove(dataListLogSampleArrayList.get(i).get(j));

					}

				}
				if (spinner4Postion == 0) {
					keyLayout.removeAllViews();
					for (LayoutTableBean bean : activityLayoutTableBeans) {
						View mGridView = View.inflate(context, R.layout.item_key, null);

						ImageView color = (ImageView) mGridView.findViewById(R.id.color);
						TextView name = (TextView) mGridView.findViewById(R.id.name);
						color.setBackground(getResources().getDrawable(getcolor(bean.getColor() + "")));
						name.setText(bean.getTarget());
						keyLayout.addView(mGridView);
					}
				} else if (spinner4Postion == 1) {
					keyLayout.removeAllViews();

					View mGridView = View.inflate(context, R.layout.item_key, null);

					ImageView color = (ImageView) mGridView.findViewById(R.id.color);
					TextView name = (TextView) mGridView.findViewById(R.id.name);

					color.setBackgroundColor(Color.parseColor("#ff2d55"));
					name.setText("sample");
					keyLayout.addView(mGridView);
					View mGridView1 = View.inflate(context, R.layout.item_key, null);

					ImageView color1 = (ImageView) mGridView1.findViewById(R.id.color);
					TextView name1 = (TextView) mGridView1.findViewById(R.id.name);

					color1.setBackgroundColor(Color.parseColor("#fd9727"));
					name1.setText("standard");
					keyLayout.addView(mGridView1);

					View mGridView2 = View.inflate(context, R.layout.item_key, null);

					ImageView color2 = (ImageView) mGridView2.findViewById(R.id.color);
					TextView name2 = (TextView) mGridView2.findViewById(R.id.name);

					color2.setBackgroundColor(Color.parseColor("#ff00a9"));
					name2.setText("positive");
					keyLayout.addView(mGridView2);

					View mGridView3 = View.inflate(context, R.layout.item_key, null);

					ImageView color3 = (ImageView) mGridView3.findViewById(R.id.color);
					TextView name3 = (TextView) mGridView3.findViewById(R.id.name);

					color3.setBackgroundColor(Color.parseColor("#159588"));
					name3.setText("negative");
					keyLayout.addView(mGridView3);

				}

				if (spinner1Postion <= (activityLayoutTableBeans.size() - 1)) {
					if (spinner2Postion == 0) {
						if (spinner3Postion == 0) {

							if (spinner4Postion == 0) {

								spinner4Util(amplificationUtil.getDataListDeltaArrayList());

							} else if (spinner4Postion == 1) {
								spinner4Util(amplificationUtil.getDataListDeltaSampleArrayList());
							}
						} else if (spinner3Postion == 1) {
							if (spinner4Postion == 0) {
								spinner4Util(amplificationUtil.getDataListDeltaLogArrayList());
							} else if (spinner4Postion == 1) {
								spinner4Util(amplificationUtil.getDataListDeltaLogSampleArrayList());
							}
						}
					} else if (spinner2Postion == 1) {
						if (spinner3Postion == 0) {

							if (spinner4Postion == 0) {
								spinner4Util(dataListArrayList);
							} else if (spinner4Postion == 1) {
								spinner4Util(dataListSampleArrayList);

							}
						} else if (spinner3Postion == 1) {
							if (spinner4Postion == 0) {
								spinner4Util(dataListLogArrayList);
							} else if (spinner4Postion == 1) {
								spinner4Util(dataListLogSampleArrayList);
							}
						}
					} else if (spinner2Postion == 2) {
						if (spinner3Postion == 0) {

							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}
						} else if (spinner3Postion == 1) {
							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}
						}
					}

				} else {

					// all

					if (spinner2Postion == 0) {
						if (spinner3Postion == 0) {

							if (spinner4Postion == 0) {
								spinner4AllUtil(amplificationUtil.getDataListDeltaArrayList());
							} else if (spinner4Postion == 1) {
								spinner4AllUtil(amplificationUtil.getDataListDeltaSampleArrayList());
							}
						} else if (spinner3Postion == 1) {
							if (spinner4Postion == 0) {
								spinner4AllUtil(amplificationUtil.getDataListDeltaLogArrayList());
							} else if (spinner4Postion == 1) {
								spinner4AllUtil(amplificationUtil.getDataListDeltaLogSampleArrayList());
							}
						}
					} else if (spinner2Postion == 1) {
						if (spinner3Postion == 0) {

							if (spinner4Postion == 0) {
								spinner4AllUtil(dataListArrayList);
							} else if (spinner4Postion == 1) {
								spinner4AllUtil(dataListSampleArrayList);
							}
						} else if (spinner3Postion == 1) {
							if (spinner4Postion == 0) {
								spinner4AllUtil(dataListLogArrayList);
							} else if (spinner4Postion == 1) {
								spinner4AllUtil(dataListLogSampleArrayList);
							}
						}
					} else if (spinner2Postion == 2) {
						if (spinner3Postion == 0) {

							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}
						} else if (spinner3Postion == 1) {
							if (spinner4Postion == 0) {

							} else if (spinner4Postion == 1) {

							}
						}
					}

				}

				lineData = new LineData(xValues, dataSets);

				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);
				chart.animateX(0); // 立即执行的动画,x轴

			}

			private void spinner4AllUtil(ArrayList<ArrayList<LineDataSet>> arrayList) {
				// 分两个基因盘数据分别遍历
				for (int i = 0; i < 16; i++) {
					if (!TextUtils.isEmpty(dataSourceListBlock1.get(i).get("item_image") + "")) {

						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
//							for (int j = 0; j < 4; j++) {
//								if (j != Integer.parseInt(passReferenceNum) - 1) {

									dataSets.add(arrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
									// dataSets.add(arrayList.get(i).get(1));
									// dataSets.add(arrayList.get(i).get(2));
									// dataSets.add(arrayList.get(i).get(3));
//								}
//							}
						}
					}

					if (!TextUtils.isEmpty(dataSourceListBlock2.get(i).get("item_image") + "")) {

						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {
//							for (int j = 0; j < 4; j++) {
//								if (j != Integer.parseInt(passReferenceNum) - 1) {

									dataSets.add(arrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
									// dataSets.add(arrayList.get(i +
									// 16).get(1));
									// dataSets.add(arrayList.get(i +
									// 16).get(2));
									// dataSets.add(arrayList.get(i +
									// 16).get(3));
//								}
//							}
						}
					}
				}

			}

			private void spinner4Util(ArrayList<ArrayList<LineDataSet>> arrayList) {
				// 分两个基因盘数据分别遍历
				for (int i = 0; i < 16; i++) {
					if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
						// 判断通道是否是一个。是显示曲线
						// 因为名字可能重复。所以决定用颜色做判断
						if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
								.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
							if (!TextUtils.isEmpty(dataSourceListBlock1.get(i).get("item_image") + "")) {

								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 1) {
									dataSets.add(arrayList.get(i).get(0));
								} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 2) {
									dataSets.add(arrayList.get(i).get(1));
								} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 3) {
									dataSets.add(arrayList.get(i).get(2));
								} else if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 4) {
									dataSets.add(arrayList.get(i).get(3));
								}
							}

						}

					}

					if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {
						// 判断通道是否是一个。是显示曲线
						// 因为名字可能重复。所以决定用颜色做判断
						if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
								.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {
							if (!TextUtils.isEmpty(dataSourceListBlock2.get(i).get("item_image") + "")) {
								// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
								if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

								} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 1) {
									dataSets.add(arrayList.get(i + 16).get(0));
								} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 2) {
									dataSets.add(arrayList.get(i + 16).get(1));
								} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 3) {
									dataSets.add(arrayList.get(i + 16).get(2));
								} else if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 4) {
									dataSets.add(arrayList.get(i + 16).get(3));
								}

							}

						}

					}
				}

			}

			@Override
			public void onNothingSelected(AdapterView<?> arg0) {
				// TODO Auto-generated method stub

			}
		});

	}

	@Override
	public void initCheckBox() {
		// TODO Auto-generated method stub

	}

	// 设置actionBar
	public void setActionBar() {
		Button leftfirstBtn, leftsecondBtn, leftThirdBtn, leftForthBtn, leftFifthBtn, leftSixthBtn, leftSevenThBtn,
				leftEighthBtn, leftNinethBtn, leftTenth_btn;
		// TextView title;

		String ExperimentType = contextString.subSequence(contextString.indexOf("ExperimentType:") + 15,
				contextString.indexOf(",SampleType:")) + "";
		leftfirstBtn = BindView(R.id.leftfirst_btn);
		leftfirstBtn.setVisibility(View.VISIBLE);
		leftsecondBtn = BindView(R.id.leftsecond_btn);
		leftsecondBtn.setVisibility(View.VISIBLE);
		leftThirdBtn = BindView(R.id.leftThird_btn);
		leftThirdBtn.setVisibility(View.VISIBLE);
		leftForthBtn = BindView(R.id.leftForth_btn);
		leftForthBtn.setVisibility(View.VISIBLE);
		leftFifthBtn = BindView(R.id.leftFifth_btn);
		leftFifthBtn.setVisibility(View.VISIBLE);
		leftSixthBtn = BindView(R.id.leftSixth_btn);
		leftSixthBtn.setVisibility(View.VISIBLE);
		leftSevenThBtn = BindView(R.id.leftSevenTh_btn);
		leftSevenThBtn.setVisibility(View.VISIBLE);
		leftEighthBtn = BindView(R.id.leftEighth_btn);
		leftEighthBtn.setVisibility(View.VISIBLE);
		leftNinethBtn = BindView(R.id.leftNineth_btn);
		leftNinethBtn.setVisibility(View.VISIBLE);

		leftsecondBtn.setSelected(true);

		if (ExperimentType.equals("绝对定量") || ExperimentType.equals("Absolute Quantitation")) {
			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.INVISIBLE);

			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_standarad);
			leftForthBtn.setText(R.string.ana_multiplot);
			leftFifthBtn.setText(R.string.ana_rawdata);
			leftSixthBtn.setText(R.string.ana_meltcurve);
			leftSevenThBtn.setText(R.string.ana_result);
			leftEighthBtn.setText(R.string.ana_report);
			leftNinethBtn.setText(R.string.ana_analysissetting);

			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", false, false);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeStandardCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", false, false);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", false, false);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", false, false);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});

		} else if (ExperimentType.equals("标准曲线相对定量") || ExperimentType.equals("Standard Curve Relative Quantitation")) {

			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.VISIBLE);
			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_standarad);
			leftForthBtn.setText(R.string.ana_multiplot);
			leftFifthBtn.setText(R.string.ana_rawdata);
			leftSixthBtn.setText(R.string.ana_meltcurve);
			leftSevenThBtn.setText(R.string.ana_rela_quan);
			leftEighthBtn.setText(R.string.ana_result);
			leftNinethBtn.setText(R.string.ana_report);
			leftTenth_btn.setText(R.string.ana_analysissetting);
			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeStandardCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRelativeQuanticationActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftTenth_btn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
		} else if (ExperimentType.equals("比较ct值相对定量") || ExperimentType.equals("⊿Ct Relative Quantitation")) {

			leftTenth_btn = BindView(R.id.leftTenth_btn);
			leftTenth_btn.setVisibility(View.VISIBLE);

			leftfirstBtn.setText(R.string.item_actionbar_home);
			leftsecondBtn.setText(R.string.ana_amplification);
			leftThirdBtn.setText(R.string.ana_multiplot);
			leftForthBtn.setText(R.string.ana_rawdata);
			leftFifthBtn.setText(R.string.ana_meltcurve);
			leftSixthBtn.setText(R.string.ana_rela_quan);
			leftSevenThBtn.setText(R.string.ana_result);
			leftEighthBtn.setText(R.string.ana_report);
			leftNinethBtn.setText(R.string.ana_analysissetting);

			leftThirdBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeMulticomponentPlotActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();
				}
			});
			leftForthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRawDataActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftFifthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeMeltCurveActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSixthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRelativeQuanticationActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftSevenThBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										AnalyzeRawDataTwoActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftEighthBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this, ReportActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftNinethBtn.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					System.gc();
					pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

					new Thread() {
						public void run() {
							try {
								Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
										ParameterSettingActivity.class);
								startActivity(intent);
								finish();
							} finally {
								messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
							}
						}
					}.start();

				}
			});
			leftTenth_btn.setVisibility(View.INVISIBLE);

		}

		leftfirstBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				// pd = ProgressDialog.show(this, "", "loading...", true, true);
				pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {

							BaseApplication.getInstance().finishAll();
							Intent intent = new Intent(AnalyzeAmplificationplotActivity.this, MainMenuActivity.class);
							startActivity(intent);

						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
				finish();

			}
		});
		leftsecondBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {

				// v.setSelected(!v.isSelected());

			}

		});
		Boolean noRongJie=false;
		for(int i= 0; i<activityMethodBeans.size();i++){
			if(!TextUtils.isEmpty(activityMethodBeans.get(i).getDeltaT())){
				noRongJie=true;
		}
		if(!noRongJie){
			 if (getText(R.string.ana_meltcurve).equals(leftFifthBtn.getText())) {
			 }
				 leftFifthBtn.setVisibility(View.GONE);
			}else if (getText(R.string.ana_meltcurve).equals(leftSixthBtn.getText())) {
				leftSixthBtn.setVisibility(View.GONE);
			}
		}

	}

	// 获取当前时间的方法
	public void setSystemTime() {

		TextView date, fileName;
		date = BindView(R.id.date);
		fileName = BindView(R.id.file_name);

		// 获取系统时间
		SimpleDateFormat sdfDate = new SimpleDateFormat("MM dd,yyyy");
		date.setText(sdfDate.format(new Date()));

		// 文件路径置空
		fileName.setText("");
		// 文件路径置空
		fileName.setText(SharedPreferencesUtils.get(this, BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "") + "/"
				+ SharedPreferencesUtils.get(this, BaseApplication.FILEMANGER_PREPAREFILENAME, ""));

	}

	// 设置bottom布局
	public void setBottomView() {
		Button bottomLeftFistBtn, bottomCenterBtn, bottomRightBtn;

		bottomLeftFistBtn = BindView(R.id.bottomLeftFistBtn);
		bottomCenterBtn = BindView(R.id.bottomCenterBtn);
		bottomRightBtn = BindView(R.id.bottomRightBtn);

		bottomLeftFistBtn.setVisibility(View.VISIBLE);
		// bottomCenterBtn.setVisibility(View.VISIBLE);
		bottomRightBtn.setVisibility(View.VISIBLE);

		bottomLeftFistBtn.setText(R.string.bottomView_back);
		// TODO 这个button的文字不确定暂时用A代替
		bottomCenterBtn.setText("A"); // 不确定！！！！！！！
		bottomRightBtn.setText(R.string.bottomView_next);

		bottomLeftFistBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// ByAlert.alert("back");

				// ActivityManager activityManager = (ActivityManager) context
				// .getSystemService(Context.ACTIVITY_SERVICE);
				// ByAlert.alert(activityManager.getMemoryClass()+"");

				System.gc();
				pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", false, false);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
									AnalyzeBrowseActivity.class);
							// intent.putStringArrayListExtra("data_list1",
							// data_list1);s
							startActivity(intent);
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
				finish();

			}
		});

		bottomCenterBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// ByAlert.alert("A");

			}
		});
		bottomRightBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				System.gc();
				pd = ProgressDialog.show(AnalyzeAmplificationplotActivity.this, "", "loading...", true, true);

				new Thread() {
					public void run() {
						try {
							Intent intent = new Intent(AnalyzeAmplificationplotActivity.this,
									AnalyzeStandardCurveActivity.class);
							// intent.putStringArrayListExtra("data_list1",
							// data_list1);s
							startActivity(intent);
						} finally {
							messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
						}
					}
				}.start();
				finish();

			}
		});
	}

	// menu的弹出窗口
	private void showMenuPopupWindow(View v) {

		if (null == menuPopupWindow || !menuPopupWindow.isShowing()) {
			View contentView = LayoutInflater.from(this).inflate(R.layout.fragment_run_menu, null);

			menuPopupWindow = new PopupWindow(contentView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			menuPopupWindow.setBackgroundDrawable(new BitmapDrawable());
			menuPopupWindow.setTouchable(true);
			menuPopupWindow.setOutsideTouchable(true);
			menuPopupWindow.showAsDropDown(v, -40, -3);

			TextView amplificationTv, temperatureTv, methodTv;
			amplificationTv = (TextView) contentView.findViewById(R.id.amplificationTv);
			temperatureTv = (TextView) contentView.findViewById(R.id.temperatureTv);
			methodTv = (TextView) contentView.findViewById(R.id.methodTv);

			amplificationTv.setBackground(getResources().getDrawable(R.color.darkBlue));
			amplificationTv.setTextColor(this.getResources().getColor(R.color.white));
			temperatureTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					menuPopupWindow.dismiss();
					Intent intent = new Intent(AnalyzeAmplificationplotActivity.this, TemparetureActivity.class);
					startActivity(intent);

				}
			});
			methodTv.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					// Intent intent =new Intent(BaseInformationActivity, uri)
					menuPopupWindow.dismiss();
					Intent intent = new Intent(AnalyzeAmplificationplotActivity.this, RunMethodActivity.class);
					startActivity(intent);
				}
			});

		} else {
			menuPopupWindow.dismiss();
			menuboo = !menuboo;
		}

	}

	public class DragGridViewAdapter extends BaseAdapter {
		List<HashMap<String, Object>> dataSourceListBlock = new ArrayList<HashMap<String, Object>>();

		public DragGridViewAdapter(List<HashMap<String, Object>> dataSourceListBlock) {
			super();
			this.dataSourceListBlock = dataSourceListBlock;
		}

		public void changeList(List<HashMap<String, Object>> dataSourceListBlock) {

			this.dataSourceListBlock = dataSourceListBlock;
			notifyDataSetChanged();
		}

		class ViewHolder {

			LinearLayout line, textViewLine;
			ImageView item_image;
			TextView item_text, aisle1, aisle2, aisle3, aisle4;

		}

		@Override
		public int getCount() {
			return dataSourceListBlock != null ? dataSourceListBlock.size() : 0;
		}

		@Override
		public Object getItem(int position) {
			return dataSourceListBlock != null ? dataSourceListBlock.get(position) : null;
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			final ViewHolder holder;
			if (convertView == null) {
				holder = new ViewHolder();
				convertView = LayoutInflater.from(AnalyzeAmplificationplotActivity.this)
						.inflate(R.layout.item_layout2_grid, null);

				holder.line = (LinearLayout) convertView.findViewById(R.id.line);
				holder.item_image = (ImageView) convertView.findViewById(R.id.item_image);
				holder.item_text = (TextView) convertView.findViewById(R.id.item_text);
				holder.aisle1 = (TextView) convertView.findViewById(R.id.aisle1);
				holder.aisle2 = (TextView) convertView.findViewById(R.id.aisle2);
				holder.aisle3 = (TextView) convertView.findViewById(R.id.aisle3);
				holder.aisle4 = (TextView) convertView.findViewById(R.id.aisle4);
				holder.textViewLine = (LinearLayout) convertView.findViewById(R.id.textViewLine);

				convertView.setTag(holder);
			} else {
				holder = (ViewHolder) convertView.getTag();
			}
			holder.aisle1.setVisibility(View.VISIBLE);
			holder.aisle2.setVisibility(View.VISIBLE);
			holder.aisle3.setVisibility(View.VISIBLE);
			holder.aisle4.setVisibility(View.VISIBLE);
			holder.textViewLine.setBackground(getResources().getDrawable(R.color.darkBlue));

			if (dataSourceListBlock.get(position).get("item_aisle") != null) {
				if (!TextUtils.isEmpty(dataSourceListBlock.get(position).get("item_aisle") + "")) {

					if (Integer.parseInt(dataSourceListBlock.get(position).get("item_aisle").toString()) != 0) {
						int aisleNum = (Integer) dataSourceListBlock.get(position).get("item_aisle");
						holder.textViewLine.setVisibility(View.VISIBLE);
						holder.aisle1.setVisibility(View.VISIBLE);
						holder.aisle2.setVisibility(View.VISIBLE);
						holder.aisle3.setVisibility(View.VISIBLE);
						holder.aisle4.setVisibility(View.VISIBLE);
						switch (aisleNum) {
						case 1:
							setcolor(holder.aisle1, position, holder.textViewLine);
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));

							break;
						case 2:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle2, position, holder.textViewLine);
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));

							break;

						case 3:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle3, position, holder.textViewLine);
							holder.aisle4.setBackground(getResources().getDrawable(R.color.white));
							break;

						case 4:
							holder.aisle1.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle2.setBackground(getResources().getDrawable(R.color.white));
							holder.aisle3.setBackground(getResources().getDrawable(R.color.white));
							setcolor(holder.aisle4, position, holder.textViewLine);
							break;

						default:
							break;
						}
					} else {
						holder.textViewLine.setVisibility(View.INVISIBLE);
						holder.aisle1.setVisibility(View.INVISIBLE);
						holder.aisle2.setVisibility(View.INVISIBLE);
						holder.aisle3.setVisibility(View.INVISIBLE);
						holder.aisle4.setVisibility(View.INVISIBLE);
					}

				} else {
					holder.textViewLine.setVisibility(View.INVISIBLE);
					holder.aisle1.setVisibility(View.INVISIBLE);
					holder.aisle2.setVisibility(View.INVISIBLE);
					holder.aisle3.setVisibility(View.INVISIBLE);
					holder.aisle4.setVisibility(View.INVISIBLE);
				}
			}

			holder.line.setBackground(getResources().getDrawable(R.color.white));
			if (dataSourceListBlock.get(position).get("item_selected") != null) {

				if ((Boolean) dataSourceListBlock.get(position).get("item_selected")) {
					holder.line.setBackground(getResources().getDrawable(R.color.darkBlue));
				} else {
					holder.line.setBackground(getResources().getDrawable(R.color.white));
				}

			} else {
				holder.line.setBackground(getResources().getDrawable(R.color.white));
			}

			// map.put("item_type", "positive");

			if ("sample".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#ff2d55"));
			} else if ("standard".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#fd9727"));
			} else if ("positive".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#ff00a9"));
			} else if ("negative".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackgroundColor(Color.parseColor("#159588"));
			} else if (dataSourceListBlock.get(position).get("item_image") == null) {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			} else if ("".equals(dataSourceListBlock.get(position).get("item_type"))) {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			} else {
				holder.item_image.setBackground(getResources().getDrawable(R.color.white));
			}

			// if
			// ("".equals(dataSourceListBlock.get(position).get("item_image")))
			// {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.white));
			// } else if ("11".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_one));
			// } else if ("12".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_two));
			// } else if ("13".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_three));
			// } else if ("14".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_four));
			// } else if ("15".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_five));
			// } else if ("16".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_one_six));
			// } else if ("21".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_one));
			// } else if ("22".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_two));
			// } else if ("23".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_three));
			// } else if ("24".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_four));
			// } else if ("25".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_five));
			// } else if ("26".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_two_six));
			// } else if ("31".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_one));
			// } else if ("32".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_two));
			// } else if ("33".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_three));
			// } else if ("34".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_four));
			// } else if ("35".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_five));
			// } else if ("36".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_three_six));
			// } else if ("41".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_one));
			// } else if ("42".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_two));
			// } else if ("43".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_three));
			// } else if ("44".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_four));
			// } else if ("45".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_five));
			// } else if ("46".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_four_six));
			// } else if ("51".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_one));
			// } else if ("52".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_two));
			// } else if ("53".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_three));
			// } else if ("54".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_four));
			// } else if ("55".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_five));
			// } else if ("56".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_five_six));
			// } else if ("61".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_one));
			// } else if ("62".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_two));
			// } else if ("63".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_three));
			// } else if ("64".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_four));
			// } else if ("65".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_five));
			// } else if ("66".equals(dataSourceListBlock.get(position).get(
			// "item_image"))) {
			// holder.item_image.setBackground(getResources().getDrawable(
			// R.color.palette_six_six));
			// }
			holder.item_text.setText(dataSourceListBlock.get(position).get("item_text") + "");

			return convertView;
		}

		private void setcolor(TextView aisle, int position, LinearLayout textViewLine) {
			if ("".equals(dataSourceListBlock.get(position).get("item_image").toString().trim())) {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);
				textViewLine.setBackground(getResources().getDrawable(R.color.white));
			} else if ("11".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_one));
			} else if ("12".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_two));
			} else if ("13".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_three));
			} else if ("14".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_four));
			} else if ("15".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_five));
			} else if ("16".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_one_six));
			} else if ("21".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_one));
			} else if ("22".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_two));
			} else if ("23".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_three));
			} else if ("24".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_four));
			} else if ("25".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_five));
			} else if ("26".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_two_six));
			} else if ("31".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_one));
			} else if ("32".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_two));
			} else if ("33".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_three));
			} else if ("34".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_four));
			} else if ("35".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_five));
			} else if ("36".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_three_six));
			} else if ("41".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_one));
			} else if ("42".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_two));
			} else if ("43".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_three));
			} else if ("44".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_four));
			} else if ("45".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_five));
			} else if ("46".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_four_six));
			} else if ("51".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_one));
			} else if ("52".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_two));
			} else if ("53".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_three));
			} else if ("54".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_four));
			} else if ("55".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_five));
			} else if ("56".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_five_six));
			} else if ("61".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_one));
			} else if ("62".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_two));
			} else if ("63".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_three));
			} else if ("64".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_four));
			} else if ("65".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_five));
			} else if ("66".equals(dataSourceListBlock.get(position).get("item_image"))) {
				aisle.setBackground(getResources().getDrawable(R.color.palette_six_six));
			} else if (dataSourceListBlock.get(position).get("item_image") == null) {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);

			} else {
				aisle.setBackground(getResources().getDrawable(R.color.white));
				// textViewLine.setVisibility(View.INVISIBLE);
				aisle.setBackground(getResources().getDrawable(R.color.white));
			}

		}
	}

	private void addLineChart(ArrayList<Entry> yValues, String colorString, int type) {
		dataSet = new LineDataSet(yValues, "");
		// dataSet.setLineWidth(0);
		if (type == 1) {
			if (TextUtils.isEmpty(colorString)) {
				dataSet.setColor(color.white);
			} else {
				dataSet.setColor(getResources().getColor(getcolor(colorString)));
			}
		} else if (type == 2) {
			if (TextUtils.isEmpty(colorString)) {
				dataSet.setColor(color.white);
			} else {
				dataSet.setColor(Color.parseColor(colorString));
			}
		}

		dataSet.setCircleSize(0);
		dataSet.setValueTextSize(0);
		dataSet.setLineWidth(1);
	}

	// private void addLineChart(ArrayList<Entry> yValues) {
	// dataSet = new LineDataSet(yValues, "");
	// // dataSet.setLineWidth(0);
	//
	// dataSet.setColor(color.red);
	// dataSet.setCircleSize(0);
	// dataSet.setValueTextSize(0);
	// dataSet.setLineWidth(1);
	// }

	@Override
	public void initToolLine() {
		BLEndCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

				try {
					try {
						pd.dismiss();
					} catch (Exception e) {
						// TODO: handle exception
					}

					// pd = ProgressDialog.show(
					// AnalyzeAmplificationplotActivity.this, "",
					// "loading...", false, false);
				} catch (Exception e) {
					// TODO: handle exception
				}

				final Handler handler = new Handler();
				new Thread() {
					public void run() {
						// BLEndCb.setEnabled(false);
						handler.post(runnableBaseLineUi);
					}
				}.start();

			}
		});

		ThresholdCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

				for (LineDataSet line : lineDataSets) {

					dataSets.remove(line);

				}

				// 先判断是不是target是不是all如果是all显示4条
				if ("All".equals(data_list1.get(spinner1Postion))) {
					// 根据是否选中 显示四条线
					if (isChecked) {
						for (LineDataSet line : lineDataSets) {
							dataSets.add(line);

						}

						// 将数据插入
						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴

					} else {
						for (LineDataSet line : lineDataSets) {

							dataSets.remove(line);
						}

						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴
					}

				} else {
					// 根据是否选中 显示spinner1指定的线

					if (isChecked) {
						// for (LineDataSet line : lineDataSets) {
						// if (data_list1.get(spinner1Postion).equals(
						// amplificationUtil.getCtSettingBeans().get(spinner1Postion).getTargetName()))
						// {
						// dataSets.add(line);
						// }
						//
						// }
						dataSets.add(lineDataSets.get(spinner1Postion));
						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴

					} else {
						for (LineDataSet line : lineDataSets) {
							dataSets.remove(line);
						}

						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴
					}

					// if (isChecked) {
					//
					// dataSets.add(line);
					//
					// // 将数据插入
					// LineData lineData = new LineData(xValues, dataSets);
					//
					// // mLineChart2.setBackgroundColor(Color.BLUE);
					// chart.setGridBackgroundColor(Color.WHITE);
					// // 将数据插入
					// chart.setData(lineData);
					// Legend mLegend = chart.getLegend(); //
					// // 设置比例图标示，就是那个一组y的value的
					// mLegend.setXEntrySpace(7f);
					// mLegend.setYEntrySpace(5f);
					// chart.animateX(0); // 立即执行的动画,x轴
					// } else {
					//
					// dataSets.remove(line);
					//
					// // dataSets.clear();
					// // 将数据插入
					// LineData lineData = new LineData(xValues, dataSets);
					//
					// // mLineChart2.setBackgroundColor(Color.BLUE);
					// chart.setGridBackgroundColor(Color.WHITE);
					// // 将数据插入
					// chart.setData(lineData);
					// Legend mLegend = chart.getLegend(); //
					// // 设置比例图标示，就是那个一组y的value的
					// mLegend.setXEntrySpace(7f);
					// mLegend.setYEntrySpace(5f);
					// chart.animateX(0); // 立即执行的动画,x轴
					// }
				}

				// 先确定

			}
		});
		AutoCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {

				if (isChecked) {
					AutoBLCb.setEnabled(false);
					AutoBLCb.setChecked(true);

					numberTv.setEnabled(false);

//					if (AutoCbState == 0) {
						numberTv.setText(amplificationUtil.getAutoNumberTv(data_list1.get(spinner1Postion),
								activityLayoutTableBeans) + "");
						amplificationUtil.getCtSettingBeans().get(spinner1Postion).setAutoThreshold(true);
						amplificationUtil.getCtSettingBeans().get(spinner1Postion).setThreshold(numberTv.getText()+"");
//					} else if (AutoCbState == 1) {
//
//					}

					// lineDataSets.set(spinner1Postion, new)

					// 写文件 将数据写进文件

					FileManagerUtil fileManagerUtil = new FileManagerUtil();
					// 创建文件
					String folderName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
							BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "0") + "";
					String fileName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
							BaseApplication.FILEMANGER_PREPAREFILENAME, "0") + "";

					// 这个方法和之前的一样，先一行一行的全部取出来。然后当遇到本页面数据。我们不做添加然后在这时我们要加入接下来的文件的数据
					String path = appFilePath + "/" + folderName;
					File file = new File(path + "/" + fileName);
					BufferedReader reader = null;
					StringBuffer contextString = new StringBuffer();
					System.gc();
					try {
						System.out.println("以行为单位读取文件内容，一次读一整行:");
						reader = new BufferedReader(new FileReader(file));

						String tempString = "";
						int line = 1;
						// 一次读入一行，直到读入null为文件结束
						Boolean layoutOneBoolean = false;
						while ((tempString = reader.readLine()) != null) {
							// 显示行号
							// System.out.println("line " + line + ": "
							// +
							// tempString);
							// Log.e("--", tempString);
							if (tempString.contains("ParameterSetting")) {
								break;
							}

							contextString.append(tempString);
							contextString.append("\r\n");
							line++;
						}

						reader.close();

					} catch (IOException e) {
						e.printStackTrace();
					} finally {
						if (reader != null) {
							try {
								reader.close();
								// LogUtil.e("!!", contextString + "");

							} catch (IOException e1) {
							}
						}
					}

					// StringBuffer content = new StringBuffer();

					contextString.append("ParameterSetting" + "\r\n");
					contextString.append("\r\n" + "default" + "\r\n");
					contextString
							.append("\r\n" + "defaultThresholdBoo" + ":" + amplificationUtil.getDefaultThresholdBoo());
					contextString.append("\r\n" + "defaultThreshold" + ":" + amplificationUtil.getDefaultThreshold());
					contextString
							.append("\r\n" + "defaultBaselineBoo" + ":" + amplificationUtil.getDefaultBaselineBoo());
					contextString.append("\r\n" + "defaultStart" + ":" + amplificationUtil.getDefaultStart());
					contextString.append("\r\n" + "defaultEnd" + ":" + amplificationUtil.getDefaultEnd());

					contextString.append("\r\n" + "\r\n" + "ctSettingBeans" + "\r\n");
					for (int i = 0; i < amplificationUtil.getCtSettingBeans().size(); i++) {
						contextString.append("\r\n" + "targetName" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getTargetName());
						contextString.append("\r\n" + "threshold" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getThreshold());
						contextString.append("\r\n" + "baselineStart" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getBaselineStart());
						contextString.append("\r\n" + "baselineEnd" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getBaselineEnd());
						contextString.append("\r\n" + "useDaultSetting" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).isUseDaultSetting());
						contextString.append("\r\n" + "isAutoThreshold" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).isAutoThreshold());
						contextString.append("\r\n" + "isAutoBaseLine" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).isAutoBaseLine());

					}
					if (amplificationUtil.getAdvancedSettingBeans() != null
							&& amplificationUtil.getAdvancedSettingBeans().size() > 0) {
						contextString.append("\r\n" + "\r\n" + "advancedSettingBeans" + "\r\n");
						for (int i = 0; i < amplificationUtil.getAdvancedSettingBeans().size(); i++) {
							contextString.append("\r\n" + "well" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getWell());
							contextString.append("\r\n" + "targetName" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName());
							contextString.append("\r\n" + "baseLineName" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaseLine());
							contextString.append("\r\n" + "baselineStart" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart());
							contextString.append("\r\n" + "baselineEnd" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString());
							contextString.append("\r\n" + "useCTSetingBoo" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getUseCTSetingBoo());
							contextString.append("\r\n" + "autoBaselineBoolean" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getAutoBaselineBoolean());
						}

					}

					fileManagerUtil.createFIle(folderName, fileName);
					fileManagerUtil.writeFile(folderName, fileName, "" + contextString, false);

					// for (CtSettingBean bean :
					// amplificationUtil.getCtSettingBeans()) {
					// LineDataSet line;
					// ArrayList<Entry> yValue = new ArrayList<Entry>();
					// for (int i = 0; i < repititions; i++) {
					// yValue.add(new Entry(Float.parseFloat(bean.getThreshold()
					// .trim()), i));
					// }
					//
					// line = new LineDataSet(yValue, "");
					// line.setColor(Color.RED);
					// line.setCircleSize(0);
					// // line.setDrawCircleHole(true);
					//
					// line.setCircleColor(Color.RED);
					// line.setValueTextSize(0);
					// lineDataSets.add(line);
					// }
					for (int i = 0; i < dataSets.size(); i++) {
						for (LineDataSet line : lineDataSets) {
							try {
								if (dataSets.get(i).toString().equals(line.toString())) {
									dataSets.remove(i);
								}
							} catch (Exception e) {
								// TODO: handle exception
							}

						}
					}
					amplificationUtil = new AmplificationUtil();
					amplificationUtil.getAnalySetting(context, dataSourceListBlock1, dataSourceListBlock2, repititions,
							dataListArrayList);
					for (CtSettingBean bean : amplificationUtil.getCtSettingBeans()) {
						if (bean.getTargetName().equals(data_list1.get(spinner1Postion))) {
							LineDataSet line;
							ArrayList<Entry> yValue = new ArrayList<Entry>();
							for (int i = 0; i < repititions; i++) {
								yValue.add(new Entry(Float.parseFloat(bean.getThreshold().trim()), i));
							}

							line = new LineDataSet(yValue, "");
							line.setColor(Color.RED);
							line.setCircleSize(0);
							// line.setDrawCircleHole(true);

							line.setCircleColor(Color.RED);
							line.setValueTextSize(0);
							lineDataSets.set(spinner1Postion, line);
						}

						// lineDataSets.add(line);
					}

					if (ThresholdCb.isChecked()) {
						// 先判断是不是all
						if ("All".equals(data_list1.get(spinner1Postion))) {
							for (LineDataSet line : lineDataSets) {
								dataSets.add(line);

							}
							// 将数据插入
							LineData lineData = new LineData(xValues, dataSets);
							chart.setGridBackgroundColor(Color.WHITE);
							chart.setData(lineData);
							Legend mLegend = chart.getLegend(); //
							// 设置比例图标示，就是那个一组y的value的
							mLegend.setXEntrySpace(7f);
							mLegend.setYEntrySpace(5f);
							chart.animateX(0); // 立即执行的动画,x轴
						} else {
							dataSets.add(lineDataSets.get(spinner1Postion));
							LineData lineData = new LineData(xValues, dataSets);
							chart.setGridBackgroundColor(Color.WHITE);
							chart.setData(lineData);
							Legend mLegend = chart.getLegend(); //
							// 设置比例图标示，就是那个一组y的value的
							mLegend.setXEntrySpace(7f);
							mLegend.setYEntrySpace(5f);
							chart.animateX(0); // 立即执行的动画,x轴
						}
					} else {
						if ("All".equals(data_list1.get(spinner1Postion))) {
							for (LineDataSet line : lineDataSets) {

								dataSets.remove(line);
							}
							LineData lineData = new LineData(xValues, dataSets);
							chart.setGridBackgroundColor(Color.WHITE);
							chart.setData(lineData);
							Legend mLegend = chart.getLegend(); //
							// 设置比例图标示，就是那个一组y的value的
							mLegend.setXEntrySpace(7f);
							mLegend.setYEntrySpace(5f);
							chart.animateX(0); // 立即执行的动画,x轴
						} else {
							// for (LineDataSet line : lineDataSets) {
							// dataSets.remove(line);
							// }

							dataSets.remove(lineDataSets.get(spinner1Postion));

							LineData lineData = new LineData(xValues, dataSets);
							chart.setGridBackgroundColor(Color.WHITE);
							chart.setData(lineData);
							Legend mLegend = chart.getLegend(); //
							// 设置比例图标示，就是那个一组y的value的
							mLegend.setXEntrySpace(7f);
							mLegend.setYEntrySpace(5f);
							chart.animateX(0); // 立即执行的动画,x轴
						}
					}
					AutoCbState = 1;
				} else {

					AutoBLCb.setEnabled(true);
					numberTv.setEnabled(true);
					// numberTv.setText("");
					// ByAlert.alert(isChecked + "");

					for (int i = 0; i < amplificationUtil.getCtSettingBeans().size(); i++) {
						if (amplificationUtil.getCtSettingBeans().get(i).getTargetName()
								.equals(data_list1.get(spinner1Postion))) {
							amplificationUtil.getCtSettingBeans().get(i).setAutoThreshold(false);
							amplificationUtil.getCtSettingBeans().get(i).setThreshold(numberTv.getText() + "");
						}
					}

					// 写文件 将数据写进文件

					FileManagerUtil fileManagerUtil = new FileManagerUtil();
					// 创建文件
					String folderName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
							BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "0") + "";
					String fileName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
							BaseApplication.FILEMANGER_PREPAREFILENAME, "0") + "";

					// 这个方法和之前的一样，先一行一行的全部取出来。然后当遇到本页面数据。我们不做添加然后在这时我们要加入接下来的文件的数据
					String path = appFilePath + "/" + folderName;
					File file = new File(path + "/" + fileName);
					BufferedReader reader = null;
					StringBuffer contextString = new StringBuffer();
					try {
						System.out.println("以行为单位读取文件内容，一次读一整行:");
						reader = new BufferedReader(new FileReader(file));

						String tempString = "";
						int line = 1;
						// 一次读入一行，直到读入null为文件结束
						Boolean layoutOneBoolean = false;
						while ((tempString = reader.readLine()) != null) {
							// 显示行号
							// System.out.println("line " + line + ": "
							// +
							// tempString);
							// Log.e("--", tempString);
							if (tempString.contains("ParameterSetting")) {
								break;
							}

							contextString.append(tempString);
							contextString.append("\r\n");
							line++;
						}

						reader.close();

					} catch (IOException e) {
						e.printStackTrace();
					} finally {
						if (reader != null) {
							try {
								reader.close();
								// LogUtil.e("!!", contextString + "");

							} catch (IOException e1) {
							}
						}
					}

					// StringBuffer content = new StringBuffer();

					contextString.append("ParameterSetting" + "\r\n");
					contextString.append("\r\n" + "default" + "\r\n");
					contextString
							.append("\r\n" + "defaultThresholdBoo" + ":" + amplificationUtil.getDefaultThresholdBoo());
					contextString.append("\r\n" + "defaultThreshold" + ":" + amplificationUtil.getDefaultThreshold());
					contextString
							.append("\r\n" + "defaultBaselineBoo" + ":" + amplificationUtil.getDefaultBaselineBoo());
					contextString.append("\r\n" + "defaultStart" + ":" + amplificationUtil.getDefaultStart());
					contextString.append("\r\n" + "defaultEnd" + ":" + amplificationUtil.getDefaultEnd());

					contextString.append("\r\n" + "\r\n" + "ctSettingBeans" + "\r\n");
					for (int i = 0; i < amplificationUtil.getCtSettingBeans().size(); i++) {
						contextString.append("\r\n" + "targetName" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getTargetName());
						contextString.append("\r\n" + "threshold" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getThreshold());
						contextString.append("\r\n" + "baselineStart" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getBaselineStart());
						contextString.append("\r\n" + "baselineEnd" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).getBaselineEnd());
						contextString.append("\r\n" + "useDaultSetting" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).isUseDaultSetting());
						contextString.append("\r\n" + "isAutoThreshold" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).isAutoThreshold());
						contextString.append("\r\n" + "isAutoBaseLine" + ":"
								+ amplificationUtil.getCtSettingBeans().get(i).isAutoBaseLine());

					}
					if (amplificationUtil.getAdvancedSettingBeans() != null
							&& amplificationUtil.getAdvancedSettingBeans().size() > 0) {
						contextString.append("\r\n" + "\r\n" + "advancedSettingBeans" + "\r\n");
						for (int i = 0; i < amplificationUtil.getAdvancedSettingBeans().size(); i++) {
							contextString.append("\r\n" + "well" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getWell());
							contextString.append("\r\n" + "targetName" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName());
							contextString.append("\r\n" + "baseLineName" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaseLine());
							contextString.append("\r\n" + "baselineStart" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart());
							contextString.append("\r\n" + "baselineEnd" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString());
							contextString.append("\r\n" + "useCTSetingBoo" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getUseCTSetingBoo());
							contextString.append("\r\n" + "autoBaselineBoolean" + ":"
									+ amplificationUtil.getAdvancedSettingBeans().get(i).getAutoBaselineBoolean());
						}

					}

					fileManagerUtil.createFIle(folderName, fileName);
					fileManagerUtil.writeFile(folderName, fileName, "" + contextString, false);

					AutoCbState = 0;
				}
				

			}
		});

		AutoBLCb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

				// 不管BLEndCb是否选中都要先清空
				// 32个基因盘 每个基因盘有4个通道
				for (int i = 0; i < 32; i++) {
					for (int j = 0; j < 4; j++) {
						// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
						// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()

						if (!TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())) {

							float fStart = dataListArrayList.get(i).get(j).getYValForXIndex(Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()) - 1);
							float fEnd = dataListArrayList.get(i).get(j)
									.getYValForXIndex((Integer.parseInt(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()))
									- 1);
							try {
								for (int x = 0; x < dataSets.size(); x++) {

									if (dataSets.get(x).toString()
											.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(i).getBaselineStart()))
															.toString())) {
										dataSets.remove(x);
									}
									if (dataSets.get(x).toString()
											.equals(createStartPoint(fEnd, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(i).getBaselineEndString()))
															.toString())) {
										dataSets.remove(x);
									}
								}
							} catch (Exception e) {
								// TODO: handle exception
							}

						}
					}

				}

				if (isChecked) {
					if (data_list1.get(spinner1Postion).equals("All")) {

					} else {

						// 32个基因盘 每个基因盘有4个通道
						for (int i = 0; i < 32; i++) {
							for (int j = 0; j < 4; j++) {
								// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
								// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
								if (!TextUtils.isEmpty(
										amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())) {

									float fStart = dataListArrayList.get(i).get(j).getYValForXIndex(Integer.parseInt(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()) - 1);
									float fEnd = dataListArrayList.get(i).get(j).getYValForXIndex((Integer.parseInt(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()))
											- 1);
									for (int x = 0; x < dataSets.size(); x++) {

										if (dataSets.get(x).toString()
												.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineStart()))
																.toString())) {
											dataSets.remove(x);
										}
										if (dataSets.get(x).toString()
												.equals(createStartPoint(fEnd, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineEndString()))
																.toString())) {
											dataSets.remove(x);
										}
									}

								}
							}

						}

						for (int j = 0; j < amplificationUtil.ctSettingBeans.size(); j++) {
							if (amplificationUtil.ctSettingBeans.get(j).getTargetName()
									.equals(data_list1.get(spinner1Postion))) {
								// amplificationUtil.ctSettingBeans.set(j,
								// new CtSettingBean(activityLayoutTableBeans
								// .get(j).getTarget(), sumNum / ctNum
								// + "", "1", "1"));
								amplificationUtil.getAutoBaseLine(isChecked, j, activityLayoutTableBeans,
										data_list1.get(spinner1Postion));
								// amplificationUtil.ctSettingBeans.get(j)
								// .setAutoBaseLine(true);
							}
						}

						if (BLEndCb.isChecked()) {
							// 32个基因盘 每个基因盘有4个通道
							for (int i = 0; i < 32; i++) {
								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
									if (i < 16) {
										if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
											if (amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {
												float fStart = dataListArrayList.get(i).get(j)
														.getYValForXIndex(Integer.parseInt(amplificationUtil
																.getAdvancedSettingBeans().get(i).getBaselineStart())
														- 1);
												float fEnd = dataListArrayList.get(i).get(j)
														.getYValForXIndex((Integer
																.parseInt(amplificationUtil.getAdvancedSettingBeans()
																		.get(i).getBaselineEndString()))
																- 1);

												dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineStart())));
												dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineEndString())));
											} else {

											}
										}
									} else {
										if ((Boolean) dataSourceListBlock2.get(i - 16).get("item_selected")) {
											if (amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {
												float fStart = dataListArrayList.get(i).get(j)
														.getYValForXIndex(Integer.parseInt(amplificationUtil
																.getAdvancedSettingBeans().get(i).getBaselineStart())
														- 1);
												float fEnd = dataListArrayList.get(i).get(j)
														.getYValForXIndex((Integer
																.parseInt(amplificationUtil.getAdvancedSettingBeans()
																		.get(i).getBaselineEndString()))
																- 1);

												dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineStart())));
												dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineEndString())));
											} else {

											}
										}
									}

								}

							}
						}

						// 写文件 将数据写进文件

						FileManagerUtil fileManagerUtil = new FileManagerUtil();
						// 创建文件
						String folderName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
								BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "0") + "";
						String fileName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
								BaseApplication.FILEMANGER_PREPAREFILENAME, "0") + "";

						// 这个方法和之前的一样，先一行一行的全部取出来。然后当遇到本页面数据。我们不做添加然后在这时我们要加入接下来的文件的数据
						String path = appFilePath + "/" + folderName;
						File file = new File(path + "/" + fileName);
						BufferedReader reader = null;
						StringBuffer contextString = new StringBuffer();
						try {
							System.out.println("以行为单位读取文件内容，一次读一整行:");
							reader = new BufferedReader(new FileReader(file));

							String tempString = "";
							int line = 1;
							// 一次读入一行，直到读入null为文件结束
							Boolean layoutOneBoolean = false;
							while ((tempString = reader.readLine()) != null) {
								// 显示行号
								// System.out.println("line " + line + ": "
								// +
								// tempString);
								// Log.e("--", tempString);
								if (tempString.contains("ParameterSetting")) {
									break;
								}

								contextString.append(tempString);
								contextString.append("\r\n");
								line++;
							}

							reader.close();

						} catch (IOException e) {
							e.printStackTrace();
						} finally {
							if (reader != null) {
								try {
									reader.close();
									// LogUtil.e("!!", contextString + "");

								} catch (IOException e1) {
								}
							}
						}

						// StringBuffer content = new StringBuffer();

						contextString.append("ParameterSetting" + "\r\n");
						contextString.append("\r\n" + "default" + "\r\n");
						contextString.append(
								"\r\n" + "defaultThresholdBoo" + ":" + amplificationUtil.getDefaultThresholdBoo());
						contextString
								.append("\r\n" + "defaultThreshold" + ":" + amplificationUtil.getDefaultThreshold());
						contextString.append(
								"\r\n" + "defaultBaselineBoo" + ":" + amplificationUtil.getDefaultBaselineBoo());
						contextString.append("\r\n" + "defaultStart" + ":" + amplificationUtil.getDefaultStart());
						contextString.append("\r\n" + "defaultEnd" + ":" + amplificationUtil.getDefaultEnd());

						contextString.append("\r\n" + "\r\n" + "ctSettingBeans" + "\r\n");
						for (int i = 0; i < amplificationUtil.getCtSettingBeans().size(); i++) {
							contextString.append("\r\n" + "targetName" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getTargetName());
							contextString.append("\r\n" + "threshold" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getThreshold());
							contextString.append("\r\n" + "baselineStart" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getBaselineStart());
							contextString.append("\r\n" + "baselineEnd" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getBaselineEnd());
							contextString.append("\r\n" + "useDaultSetting" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).isUseDaultSetting());
							contextString.append("\r\n" + "isAutoThreshold" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).isAutoThreshold());
							contextString.append("\r\n" + "isAutoBaseLine" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).isAutoBaseLine());

						}
						if (amplificationUtil.getAdvancedSettingBeans() != null
								&& amplificationUtil.getAdvancedSettingBeans().size() > 0) {
							contextString.append("\r\n" + "\r\n" + "advancedSettingBeans" + "\r\n");
							for (int i = 0; i < amplificationUtil.getAdvancedSettingBeans().size(); i++) {
								contextString.append("\r\n" + "well" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getWell());
								contextString.append("\r\n" + "targetName" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName());
								contextString.append("\r\n" + "baseLineName" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaseLine());
								contextString.append("\r\n" + "baselineStart" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart());
								contextString.append("\r\n" + "baselineEnd" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString());
								contextString.append("\r\n" + "useCTSetingBoo" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getUseCTSetingBoo());
								contextString.append("\r\n" + "autoBaselineBoolean" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getAutoBaselineBoolean());
							}

						}

						fileManagerUtil.createFIle(folderName, fileName);
						fileManagerUtil.writeFile(folderName, fileName, "" + contextString, false);
					}

				} else {

					if (data_list1.get(spinner1Postion).equals("All")) {

					} else {
						// 32个基因盘 每个基因盘有4个通道
						for (int i = 0; i < 32; i++) {
							for (int j = 0; j < 4; j++) {
								// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
								// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
								float fStart = dataListArrayList.get(i).get(j)
										.getYValForXIndex(Integer.parseInt(
												amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
										- 1);
								float fEnd = dataListArrayList.get(i).get(j).getYValForXIndex((Integer.parseInt(
										amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()))
										- 1);
								for (int x = 0; x < dataSets.size(); x++) {

									if (dataSets.get(x).toString()
											.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(i).getBaselineStart()))
															.toString())) {
										dataSets.remove(x);
									}
									if (dataSets.get(x).toString()
											.equals(createStartPoint(fEnd, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(i).getBaselineEndString()))
															.toString())) {
										dataSets.remove(x);
									}
								}

							}

						}

						for (int j = 0; j < amplificationUtil.ctSettingBeans.size(); j++) {
							if (amplificationUtil.ctSettingBeans.get(j).getTargetName()
									.equals(data_list1.get(spinner1Postion))) {
								// amplificationUtil.ctSettingBeans.set(j,
								// new CtSettingBean(activityLayoutTableBeans
								// .get(j).getTarget(), sumNum / ctNum
								// + "", "1", "1"));
								// amplificationUtil.ctSettingBeans.get(j)
								// .setAutoBaseLine(false);
								amplificationUtil.getAutoBaseLine(isChecked, j, activityLayoutTableBeans,
										data_list1.get(spinner1Postion));

							}
						}
						if (BLEndCb.isChecked()) {
							// 32个基因盘 每个基因盘有4个通道
							for (int i = 0; i < 32; i++) {
								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()

									if (i < 16) {
										if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
											if (amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {
												float fStart = dataListArrayList.get(i).get(j)
														.getYValForXIndex(Integer.parseInt(amplificationUtil
																.getAdvancedSettingBeans().get(i).getBaselineStart())
														- 1);
												float fEnd = dataListArrayList.get(i).get(j)
														.getYValForXIndex((Integer
																.parseInt(amplificationUtil.getAdvancedSettingBeans()
																		.get(i).getBaselineEndString()))
																- 1);

												dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineStart())));
												dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineEndString())));
											} else {

											}
										}
									} else {
										if ((Boolean) dataSourceListBlock2.get(i - 16).get("item_selected")) {
											if (amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {
												float fStart = dataListArrayList.get(i).get(j)
														.getYValForXIndex(Integer.parseInt(amplificationUtil
																.getAdvancedSettingBeans().get(i).getBaselineStart())
														- 1);
												float fEnd = dataListArrayList.get(i).get(j)
														.getYValForXIndex((Integer
																.parseInt(amplificationUtil.getAdvancedSettingBeans()
																		.get(i).getBaselineEndString()))
																- 1);

												dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineStart())));
												dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(i).getBaselineEndString())));
											} else {

											}
										}
									}

								}

							}
						}

						// 写文件 将数据写进文件

						FileManagerUtil fileManagerUtil = new FileManagerUtil();
						// 创建文件
						String folderName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
								BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "0") + "";
						String fileName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
								BaseApplication.FILEMANGER_PREPAREFILENAME, "0") + "";

						// 这个方法和之前的一样，先一行一行的全部取出来。然后当遇到本页面数据。我们不做添加然后在这时我们要加入接下来的文件的数据
						String path = appFilePath + "/" + folderName;
						File file = new File(path + "/" + fileName);
						BufferedReader reader = null;
						StringBuffer contextString = new StringBuffer();
						try {
							System.out.println("以行为单位读取文件内容，一次读一整行:");
							reader = new BufferedReader(new FileReader(file));

							String tempString = "";
							int line = 1;
							// 一次读入一行，直到读入null为文件结束
							Boolean layoutOneBoolean = false;
							while ((tempString = reader.readLine()) != null) {
								// 显示行号
								// System.out.println("line " + line + ": "
								// +
								// tempString);
								// Log.e("--", tempString);
								if (tempString.contains("ParameterSetting")) {
									break;
								}

								contextString.append(tempString);
								contextString.append("\r\n");
								line++;
							}

							reader.close();

						} catch (IOException e) {
							e.printStackTrace();
						} finally {
							if (reader != null) {
								try {
									reader.close();
									// LogUtil.e("!!", contextString + "");

								} catch (IOException e1) {
								}
							}
						}

						// StringBuffer content = new StringBuffer();

						contextString.append("ParameterSetting" + "\r\n");
						contextString.append("\r\n" + "default" + "\r\n");
						contextString.append(
								"\r\n" + "defaultThresholdBoo" + ":" + amplificationUtil.getDefaultThresholdBoo());
						contextString
								.append("\r\n" + "defaultThreshold" + ":" + amplificationUtil.getDefaultThreshold());
						contextString.append(
								"\r\n" + "defaultBaselineBoo" + ":" + amplificationUtil.getDefaultBaselineBoo());
						contextString.append("\r\n" + "defaultStart" + ":" + amplificationUtil.getDefaultStart());
						contextString.append("\r\n" + "defaultEnd" + ":" + amplificationUtil.getDefaultEnd());

						contextString.append("\r\n" + "\r\n" + "ctSettingBeans" + "\r\n");
						for (int i = 0; i < amplificationUtil.getCtSettingBeans().size(); i++) {
							contextString.append("\r\n" + "targetName" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getTargetName());
							contextString.append("\r\n" + "threshold" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getThreshold());
							contextString.append("\r\n" + "baselineStart" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getBaselineStart());
							contextString.append("\r\n" + "baselineEnd" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).getBaselineEnd());
							contextString.append("\r\n" + "useDaultSetting" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).isUseDaultSetting());
							contextString.append("\r\n" + "isAutoThreshold" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).isAutoThreshold());
							contextString.append("\r\n" + "isAutoBaseLine" + ":"
									+ amplificationUtil.getCtSettingBeans().get(i).isAutoBaseLine());

						}
						if (amplificationUtil.getAdvancedSettingBeans() != null
								&& amplificationUtil.getAdvancedSettingBeans().size() > 0) {
							contextString.append("\r\n" + "\r\n" + "advancedSettingBeans" + "\r\n");
							for (int i = 0; i < amplificationUtil.getAdvancedSettingBeans().size(); i++) {
								contextString.append("\r\n" + "well" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getWell());
								contextString.append("\r\n" + "targetName" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName());
								contextString.append("\r\n" + "baseLineName" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaseLine());
								contextString.append("\r\n" + "baselineStart" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart());
								contextString.append("\r\n" + "baselineEnd" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString());
								contextString.append("\r\n" + "useCTSetingBoo" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getUseCTSetingBoo());
								contextString.append("\r\n" + "autoBaselineBoolean" + ":"
										+ amplificationUtil.getAdvancedSettingBeans().get(i).getAutoBaselineBoolean());
							}

						}

						fileManagerUtil.createFIle(folderName, fileName);
						fileManagerUtil.writeFile(folderName, fileName, "" + contextString, false);
					}
					// if (TextUtils.isEmpty(numberTv.getText().toString())) {

					// } else {
					// float num = Float.parseFloat(numberTv.getText()
					// .toString());
					//
					// ArrayList<Entry> yValues = new ArrayList<Entry>();
					// baseLineDataSet = new LineDataSet(null, "");
					// for (int i = 0; i < 40; i++) {
					// yValues.add(new Entry(num, i));
					//
					// }
					// baseLineDataSet.clear();
					// // dataSet.setLineWidth(0);
					// baseLineDataSet.setColor(Color.RED);
					// baseLineDataSet.setCircleSize(0);
					// baseLineDataSet.setValueTextSize(0);
					// baseLineDataSet.setLineWidth(2);
					//
					// // 构建一个LineData 将dataSets放入
					// LineData lineData = new LineData(xValues,
					// baseLineDataSet);
					//
					// // mLineChart2.setBackgroundColor(Color.BLUE);
					// chart.setGridBackgroundColor(Color.WHITE);
					//
					// // 将数据插入
					// chart.setData(lineData);
					//
					// Legend mLegend = chart.getLegend();
					// // 设置比例图标示，就是那个一组y的value的 mLegend.setXEntrySpace(7f);
					// mLegend.setYEntrySpace(5f);
					// chart.animateX(0); // 立即执行的动画,x轴
					//
					// }
				}

				LineData lineData = new LineData(xValues, dataSets);
				chart.setGridBackgroundColor(Color.WHITE);
				chart.setData(lineData);
				Legend mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);
				chart.animateX(0);

			}

		});

	}

	private int getcolor(String colorString) {
		switch (Integer.parseInt(colorString)) {
		case 11:
			return R.color.palette_one_one;

		case 12:

			return R.color.palette_one_two;
		case 13:

			return R.color.palette_one_three;
		case 14:

			return R.color.palette_one_four;
		case 15:

			return R.color.palette_one_five;
		case 16:

			return R.color.palette_one_six;
		case 21:

			return R.color.palette_two_one;
		case 22:

			return R.color.palette_two_two;
		case 23:

			return R.color.palette_two_three;
		case 24:

			return R.color.palette_two_four;
		case 25:

			return R.color.palette_two_five;
		case 26:

			return R.color.palette_two_six;
		case 31:
			return R.color.palette_three_one;
		case 32:

			return R.color.palette_three_two;
		case 33:

			return R.color.palette_three_three;
		case 34:

			return R.color.palette_three_four;
		case 35:

			return R.color.palette_three_five;
		case 36:

			return R.color.palette_three_six;
		case 41:
			return R.color.palette_four_one;

		case 42:

			return R.color.palette_four_two;
		case 43:

			return R.color.palette_four_three;
		case 44:

			return R.color.palette_four_four;
		case 45:

			return R.color.palette_four_five;
		case 46:

			return R.color.palette_four_six;
		case 51:

			return R.color.palette_five_one;
		case 52:

			return R.color.palette_five_two;
		case 53:

			return R.color.palette_five_three;
		case 54:

			return R.color.palette_five_four;
		case 55:

			return R.color.palette_five_five;
		case 56:

			return R.color.palette_five_six;
		case 61:

			return R.color.palette_six_one;
		case 62:

			return R.color.palette_six_two;
		case 63:

			return R.color.palette_six_three;
		case 64:

			return R.color.palette_six_four;
		case 65:

			return R.color.palette_six_five;
		case 66:

			return R.color.palette_six_six;

		default:
			return 0;
		}

	}

	private Handler messageListener = new Handler() {
		public void handleMessage(Message msg) {
			switch (msg.arg1) {
			case TASK_LOOP_COMPLETE:
				try {
					pd.dismiss();
				} catch (Exception e) {
					// TODO: handle exception
				}
				break;

			}
		}
	};

	

	// 构建Runnable对象，在runnable中更新界面
	Runnable runnableUi = new Runnable() {
		@Override
		public void run() {
			// 更新界面
			
			if(amplificationUtil ==null){
				amplificationUtil = new AmplificationUtil();
				amplificationUtil.getAnalySetting(context, dataSourceListBlock1, dataSourceListBlock2, repititions,
						dataListArrayList);
				dataListCTArrayList = amplificationUtil.getDataListCTArrayList();
			}

			for (int i = 0; i < 32; i++) {
				for (int j = 0; j < 4; j++) {
					dataSets.remove(amplificationUtil.getDataListDeltaArrayList().get(i).get(j));
					dataSets.remove(amplificationUtil.getDataListDeltaLogArrayList().get(i).get(j));
					dataSets.remove(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i).get(j));
					dataSets.remove(amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(j));
					dataSets.remove(dataListArrayList.get(i).get(j));
					dataSets.remove(dataListLogArrayList.get(i).get(j));
					dataSets.remove(dataListSampleArrayList.get(i).get(j));
					dataSets.remove(dataListLogSampleArrayList.get(i).get(j));
					dataSets.remove(amplificationUtil.getDataListCTArrayList().get(i));

				}

			}

			try {

				ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
				for (int i = (dataSets.size() - 1); i >= 0; i--) {
					if (dataSets.get(i).getYVals().size() == 1) {
						intsArrayList.add(i);
					}

				}
				for (int i = 0; i < intsArrayList.size(); i++) {
					dataSets.remove((int) intsArrayList.get(i));
				}

				// 选择All
				if (spinner1Postion == arr_adapter1.getCount() - 1) {
					// 便利两个基因盘，获取被选中的数据，移除所有曲线。再添加所有曲线
					for (int i = 0; i < dataSourceListBlock1.size(); i++) {
						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// // 先清空
							// dataSets.remove(dataListArrayList.get(i).get(0));
							// dataSets.remove(dataListArrayList.get(i).get(1));
							// dataSets.remove(dataListArrayList.get(i).get(2));
							// dataSets.remove(dataListArrayList.get(i).get(3));
							if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

							} else {
								// 最后要加上选中的四个通道的所有曲线
								//
								// dataSets.add(dataListArrayList.get(i).get(0));
								// dataSets.add(dataListArrayList.get(i).get(1));
								// dataSets.add(dataListArrayList.get(i).get(2));
								// dataSets.add(dataListArrayList.get(i).get(3));
								if (spinner2Postion == 0) {
									if (spinner3Postion == 0) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i)
															.get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i).get(3));

//												}
//											}

										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(2));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaSampleArrayList().get(i).get(3));

//												}
//											}

										}
									} else if (spinner3Postion == 1) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(2));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaLogArrayList().get(i).get(3));
//												}
//											}
										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i)
													// .get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i)
													// .get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList().get(i)
													// .get(3));
//												}
//											}
										}
									}
								} else if (spinner2Postion == 1) {
									if (spinner3Postion == 0) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListArrayList.get(i).get(1));
													// dataSets.add(dataListArrayList.get(i).get(2));
													// dataSets.add(dataListArrayList.get(i).get(3));
//												}
//											}

										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListSampleArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListSampleArrayList.get(i).get(1));
													// dataSets.add(dataListSampleArrayList.get(i).get(2));
													// dataSets.add(dataListSampleArrayList.get(i).get(3));
//												}
//											}
										}
									} else if (spinner3Postion == 1) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(dataListLogArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogArrayList.get(i).get(1));
													// dataSets.add(dataListLogArrayList.get(i).get(2));
													// dataSets.add(dataListLogArrayList.get(i).get(3));

//												}
//											}
										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogSampleArrayList.get(i).get(Integer.parseInt(dataSourceListBlock1.get(i).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogSampleArrayList.get(i).get(1));
													// dataSets.add(dataListLogSampleArrayList.get(i).get(2));
													// dataSets.add(dataListLogSampleArrayList.get(i).get(3));
//												}
//											}
										}
									}
								} else if (spinner2Postion == 2) {
									if (amplificationUtil.getDataListCTArrayList().get(i) != null) {
										dataSets.add(amplificationUtil.getDataListCTArrayList().get(i));
									}

									// if (spinner3Postion == 0) {
									// if (spinner4Postion == 0) {
									//
									// } else if (spinner4Postion == 1) {
									//
									// }
									// } else if (spinner3Postion == 1) {
									// if (spinner4Postion == 0) {
									//
									// } else if (spinner4Postion == 1) {
									//
									// }
									// }

								}
							}

						}

					}
					for (int i = 0; i < dataSourceListBlock2.size(); i++) {
						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {
							// // 先清空
							// dataSets.remove(dataListArrayList.get(i).get(0));
							// dataSets.remove(dataListArrayList.get(i).get(1));
							// dataSets.remove(dataListArrayList.get(i).get(2));
							// dataSets.remove(dataListArrayList.get(i).get(3));
							if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

							} else {
								// 最后要加上选中的四个通道的所有曲线
								//
								// dataSets.add(dataListArrayList.get(i).get(0));
								// dataSets.add(dataListArrayList.get(i).get(1));
								// dataSets.add(dataListArrayList.get(i).get(2));
								// dataSets.add(dataListArrayList.get(i).get(3));
								if (spinner2Postion == 0) {
									if (spinner3Postion == 0) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(1));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(2));
													// dataSets.add(
													// amplificationUtil.getDataListDeltaArrayList().get(i
													// + 16).get(3));
//												}
//											}
										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i
													// + 16)
													// .get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i
													// + 16)
													// .get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList().get(i
													// + 16)
													// .get(3));
//												}
//											}
										}
									} else if (spinner3Postion == 1) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16)
													// .get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16)
													// .get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i
													// + 16)
													// .get(3));
//												}
//											}
										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(1));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(2));
													// dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
													// .get(i + 16).get(3));
//												}
//											}
										}
									}
								} else if (spinner2Postion == 1) {
									if (spinner3Postion == 0) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListArrayList.get(i
													// + 16).get(3));
//												}
//											}

										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {
													dataSets.add(dataListSampleArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListSampleArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListSampleArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListSampleArrayList.get(i
													// + 16).get(3));

//												}
//											}

										}
									} else if (spinner3Postion == 1) {
										if (spinner4Postion == 0) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListLogArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListLogArrayList.get(i
													// + 16).get(3));
//												}
//											}
										} else if (spinner4Postion == 1) {
//											for (int j = 0; j < 4; j++) {
//												if (j == Integer.parseInt(passReferenceNum) - 1) {
//
//												} else {

													dataSets.add(dataListLogSampleArrayList.get(i + 16).get(Integer.parseInt(dataSourceListBlock2.get(i+16).get("item_aisle")+"")-1));
													// dataSets.add(dataListLogSampleArrayList.get(i
													// + 16).get(1));
													// dataSets.add(dataListLogSampleArrayList.get(i
													// + 16).get(2));
													// dataSets.add(dataListLogSampleArrayList.get(i
													// + 16).get(3));
//												}
//											}
										}
									}
								} else if (spinner2Postion == 2) {
									// if (spinner3Postion == 0) {
									// if (spinner4Postion == 0) {
									//
									// } else if (spinner4Postion == 1) {
									//
									// }
									// } else if (spinner3Postion == 1) {
									// if (spinner4Postion == 0) {
									//
									// } else if (spinner4Postion == 1) {
									//
									// }
									// }
									if (amplificationUtil.getDataListCTArrayList().get(i + 16) != null) {
										dataSets.add(amplificationUtil.getDataListCTArrayList().get(i + 16));
									}
								}
							}

						}

					}
					// for (int i = 0; i < dataSourceListBlock2.size(); i++) {
					// if ((Boolean) dataSourceListBlock2.get(i).get(
					// "item_selected")) {
					// // 先清空
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(0));
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(1));
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(2));
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(3));
					// // 最后要加上选中的四个通道的所有曲线
					// if (((Integer) dataSourceListBlock1.get(i).get(
					// "item_aisle")) == 0) {
					//
					// } else {
					// dataSets.add(dataListArrayList.get(i + 16).get(
					// 0));
					// dataSets.add(dataListArrayList.get(i + 16).get(
					// 1));
					// dataSets.add(dataListArrayList.get(i + 16).get(
					// 2));
					// dataSets.add(dataListArrayList.get(i + 16).get(
					// 3));
					// }
					//
					// }
					// }

					for (LineDataSet line : lineDataSets) {

						dataSets.remove(line);

					}
					if (ThresholdCb.isChecked()) {
						for (LineDataSet line : lineDataSets) {
							dataSets.add(line);

						}
						// 将数据插入
						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴
					} else {
						for (LineDataSet line : lineDataSets) {

							dataSets.remove(line);
						}
						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴
					}

//					if (BLEndCb.isChecked()) {
//
//						// 32个基因盘 每个基因盘有4个通道
//
//						for (int i = 0; i < 16; i++) {
//							if (Boolean.parseBoolean(dataSourceListBlock1.get(i).get("item_selected") + "")
//									& (!TextUtils.isEmpty(
//											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
//											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
//													.getBaselineEndString()))) {
//
//								for (int j = 0; j < 4; j++) {
//									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
//									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
//
//									if (j != Integer.parseInt(passReferenceNum) - 1) {
//
//										if (dataListArrayList.get(i).get(j) != null) {
//
//											if (spinner2Postion == 0) {
//												float fStart = 0;
//												float fEnd = 0;
//												if (spinner3Postion == 0) {
//													fStart = amplificationUtil.getDataListDeltaArrayList().get(i).get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineStart())
//																	- 1);
//													fEnd = amplificationUtil.getDataListDeltaArrayList().get(i).get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineEndString()))
//																	- 1);
//												} else if (spinner3Postion == 1) {
//													fStart = amplificationUtil.getDataListDeltaLogArrayList().get(i)
//															.get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineStart())
//																	- 1);
//													fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(i)
//															.get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineEndString()))
//																	- 1);
//												}
//
//												if (fStart == 0 && fEnd == 0) {
//
//												} else {
//													dataSets.add(createStartPoint(fStart,
//															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
//																	.get(i).getBaselineStart())));
//													dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
//															.getAdvancedSettingBeans().get(i).getBaselineEndString())));
//												}
//
//											} else if (spinner2Postion == 1) {
//												float fStart = 0;
//												float fEnd = 0;
//												if (spinner3Postion == 0) {
//													fStart = dataListArrayList.get(i).get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineStart())
//																	- 1);
//													fEnd = dataListArrayList.get(i).get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineEndString()))
//																	- 1);
//												} else if (spinner3Postion == 1) {
//													fStart = dataListLogArrayList.get(i).get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineStart())
//																	- 1);
//													fEnd = dataListLogArrayList.get(i).get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans().get(i)
//																			.getBaselineEndString()))
//																	- 1);
//												}
//
//												if (fStart == 0 && fEnd == 0) {
//
//												} else {
//													dataSets.add(createStartPoint(fStart,
//															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
//																	.get(i).getBaselineStart())));
//													dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
//															.getAdvancedSettingBeans().get(i).getBaselineEndString())));
//												}
//
//											}
//
//											// if (spinner2Postion == 0) {
//											//
//											// float fStart =
//											// amplificationUtil.getDataListDeltaArrayList().get(i)
//											// .get(j)
//											// .getYValForXIndex(Integer.parseInt(amplificationUtil
//											// .getAdvancedSettingBeans().get(i).getBaselineStart())
//											// - 1);
//											// float fEnd =
//											// amplificationUtil.getDataListDeltaArrayList().get(i).get(j)
//											// .getYValForXIndex((Integer
//											// .parseInt(amplificationUtil.getAdvancedSettingBeans()
//											// .get(i).getBaselineEndString()))
//											// - 1);
//											//
//											// dataSets.add(createStartPoint(fStart,
//											// Integer.parseInt(amplificationUtil
//											// .getAdvancedSettingBeans().get(i).getBaselineStart())));
//											// dataSets.add(createEndPoint(fEnd,
//											// Integer.parseInt(amplificationUtil
//											// .getAdvancedSettingBeans().get(i).getBaselineEndString())));
//											//
//											// } else if (spinner2Postion == 1)
//											// {
//											//
//											// float fStart =
//											// dataListArrayList.get(i).get(j)
//											// .getYValForXIndex(Integer.parseInt(amplificationUtil
//											// .getAdvancedSettingBeans().get(i).getBaselineStart())
//											// - 1);
//											// float fEnd =
//											// dataListArrayList.get(i).get(j)
//											// .getYValForXIndex((Integer
//											// .parseInt(amplificationUtil.getAdvancedSettingBeans()
//											// .get(i).getBaselineEndString()))
//											// - 1);
//											//
//											// dataSets.add(createStartPoint(fStart,
//											// Integer.parseInt(amplificationUtil
//											// .getAdvancedSettingBeans().get(i).getBaselineStart())));
//											// dataSets.add(createEndPoint(fEnd,
//											// Integer.parseInt(amplificationUtil
//											// .getAdvancedSettingBeans().get(i).getBaselineEndString())));
//											// }
//
//										}
//									}
//								}
//
//							}
//						}
//						for (int i = 0; i < 16; i++) {
//							if (Boolean.parseBoolean(dataSourceListBlock2.get(i).get("item_selected") + "")
//									& (!TextUtils.isEmpty(
//											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
//											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
//													.getBaselineEndString()))) {
//
//								for (int j = 0; j < 4; j++) {
//									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
//									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
//									if (j != Integer.parseInt(passReferenceNum) - 1) {
//
//										if (dataListArrayList.get(i + 16).get(j) != null) {
//
//											if (spinner2Postion == 0) {
//												float fStart = 0;
//												float fEnd = 0;
//												if (spinner3Postion == 0) {
//													fStart = amplificationUtil.getDataListDeltaArrayList().get(i + 16)
//															.get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineStart())
//																	- 1);
//													fEnd = amplificationUtil.getDataListDeltaArrayList().get(i + 16)
//															.get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineEndString()))
//																	- 1);
//												} else if (spinner3Postion == 1) {
//													fStart = amplificationUtil.getDataListDeltaLogArrayList()
//															.get(i + 16).get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineStart())
//																	- 1);
//													fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(i + 16)
//															.get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineEndString()))
//																	- 1);
//												}
//
//												if (fStart == 0 && fEnd == 0) {
//
//												} else {
//													dataSets.add(createStartPoint(fStart,
//															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
//																	.get(i + 16).getBaselineStart())));
//													dataSets.add(
//															createEndPoint(fEnd,
//																	Integer.parseInt(amplificationUtil
//																			.getAdvancedSettingBeans().get(i + 16)
//																			.getBaselineEndString())));
//												}
//
//											} else if (spinner2Postion == 1) {
//
//												float fStart = 0;
//												float fEnd = 0;
//
//												if (spinner3Postion == 0) {
//													fStart = dataListArrayList.get(i + 16).get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineStart())
//																	- 1);
//													fEnd = dataListArrayList.get(i + 16).get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineEndString()))
//																	- 1);
//												} else if (spinner3Postion == 1) {
//													fStart = dataListLogArrayList.get(i + 16).get(j)
//															.getYValForXIndex(Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineStart())
//																	- 1);
//													fEnd = dataListLogArrayList.get(i + 16).get(j)
//															.getYValForXIndex((Integer.parseInt(
//																	amplificationUtil.getAdvancedSettingBeans()
//																			.get(i + 16).getBaselineEndString()))
//																	- 1);
//												}
//												if (fStart == 0 && fEnd == 0) {
//
//												} else {
//													dataSets.add(createStartPoint(fStart,
//															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
//																	.get(i + 16).getBaselineStart())));
//													dataSets.add(
//															createEndPoint(fEnd,
//																	Integer.parseInt(amplificationUtil
//																			.getAdvancedSettingBeans().get(i + 16)
//																			.getBaselineEndString())));
//												}
//
//											}
//
//										}
//									}
//
//								}
//
//							}
//						}
//						LineData lineData = new LineData(xValues, dataSets);
//						chart.setGridBackgroundColor(Color.WHITE);
//						chart.setData(lineData);
//						Legend mLegend = chart.getLegend(); //
//						// 设置比例图标示，就是那个一组y的value的
//						mLegend.setXEntrySpace(7f);
//						mLegend.setYEntrySpace(5f);
//						chart.animateX(0);
//					} else {
//
//					}
					final Handler handler = new Handler();
					new Thread() {
						public void run() {
							// BLEndCb.setEnabled(false);
							handler.post(runnableBaseLineUi);
						}
					}.start();
					// 如果选all后面不能操作
					AutoCb.setClickable(false);
					numberTv.setClickable(false);
					AutoBLCb.setClickable(false);

					AutoCb.setChecked(false);
					numberTv.setText("");
					AutoBLCb.setChecked(false);

				} else {

					for (int i = 0; i < dataSets.size(); i++) {
						for (LineDataSet line : lineDataSets) {
							if (dataSets.get(i).toString().equals(line.toString())) {
								dataSets.remove(i);
							}

						}
					}
					ArrayList<Integer> intsArrayList1 = new ArrayList<Integer>();
					for (int i = (dataSets.size() - 1); i >= 0; i--) {
						if (dataSets.get(i).getYVals().size() == 1) {
							intsArrayList1.add(i);
						}

					}
					for (int i = 0; i < intsArrayList1.size(); i++) {
						dataSets.remove((int) intsArrayList1.get(i));
					}
					if (ThresholdCb.isChecked()) {
						AutoCbState = 1;
						dataSets.add(lineDataSets.get(spinner1Postion));
						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴
					} else {
						dataSets.remove(lineDataSets.get(spinner1Postion));

						LineData lineData = new LineData(xValues, dataSets);
						chart.setGridBackgroundColor(Color.WHITE);
						chart.setData(lineData);
						Legend mLegend = chart.getLegend(); //
						// 设置比例图标示，就是那个一组y的value的
						mLegend.setXEntrySpace(7f);
						mLegend.setYEntrySpace(5f);
						chart.animateX(0); // 立即执行的动画,x轴
					}

					// 先看具体选择的的是哪一个
					// 用顔色判斷是否一致
					String chooseNameString = arr_adapter1.getItem(spinner1Postion);
					for (int i = 0; i < dataSourceListBlock1.size(); i++) {
						if ((Boolean) dataSourceListBlock1.get(i).get("item_selected")) {
							// // 先清空
							// dataSets.remove(dataListArrayList.get(i).get(0));
							// dataSets.remove(dataListArrayList.get(i).get(1));
							// dataSets.remove(dataListArrayList.get(i).get(2));
							// dataSets.remove(dataListArrayList.get(i).get(3));
							if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

							} else {
								// 最后要加上选中的四个通道的所有曲线
								//
								// dataSets.add(dataListArrayList.get(i).get(0));
								// dataSets.add(dataListArrayList.get(i).get(1));
								// dataSets.add(dataListArrayList.get(i).get(2));
								// dataSets.add(dataListArrayList.get(i).get(3));
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock1.get(i).get("item_image") + "")) {
									if (spinner2Postion == 0) {
										if (spinner3Postion == 0) {
											if (spinner4Postion == 0) {

												// 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i)
															.get(0));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i)
															.get(1));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i)
															.get(2));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {

													dataSets.add(amplificationUtil.getDataListDeltaArrayList().get(i)
															.get(3));
												}

											} else if (spinner4Postion == 1) {
												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i).get(0));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i).get(1));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {

													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i).get(2));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i).get(3));

												}

											}
										} else if (spinner3Postion == 1) {
											if (spinner4Postion == 0) {
												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(0));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(1));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(2));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(3));

												}

											} else if (spinner4Postion == 1) {
												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {

													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i).get(0));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i).get(1));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {

													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i).get(2));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i).get(3));

												}

											}
										}
									} else if (spinner2Postion == 1) {
										if (spinner3Postion == 0) {
											if (spinner4Postion == 0) {
												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(dataListArrayList.get(i).get(0));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(dataListArrayList.get(i).get(1));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(dataListArrayList.get(i).get(2));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListArrayList.get(i).get(3));

												}

											} else if (spinner4Postion == 1) {

												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {

													dataSets.add(dataListSampleArrayList.get(i).get(0));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {

													dataSets.add(dataListSampleArrayList.get(i).get(1));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(dataListSampleArrayList.get(i).get(2));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListSampleArrayList.get(i).get(3));

												}

											}
										} else if (spinner3Postion == 1) {
											if (spinner4Postion == 0) {
												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(dataListLogArrayList.get(i).get(0));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(dataListLogArrayList.get(i).get(1));

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {

													dataSets.add(dataListLogArrayList.get(i).get(2));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListLogArrayList.get(i).get(3));

												}

											} else if (spinner4Postion == 1) {
												if (((Integer) dataSourceListBlock1.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(dataListLogSampleArrayList.get(i).get(0));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(dataListLogSampleArrayList.get(i).get(1));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(dataListLogSampleArrayList.get(i).get(2));
												} else if (((Integer) dataSourceListBlock1.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListLogSampleArrayList.get(i).get(3));
												}

											}
										}
									} else if (spinner2Postion == 2) {
										// if (spinner3Postion == 0) {
										// if (spinner4Postion == 0) {
										//
										// } else if (spinner4Postion == 1) {
										//
										// }
										// } else if (spinner3Postion == 1) {
										// if (spinner4Postion == 0) {
										//
										// } else if (spinner4Postion == 1) {
										//
										// }
										// }
										// 判断跟spinner1的值是否一样
										for (int j = 0; j < data_list1.size() - 1; j++) {
											if (data_list1.get(j).equals(
													activityLayoutTableBeans.get(spinner1Postion).getTarget())) {
												if (dataSourceListBlock1.get(i).get("item_image")
														.equals(activityLayoutTableBeans.get(spinner1Postion).getColor()
																+ "")) {
													dataSets.add(amplificationUtil.getDataListCTArrayList().get(i));

												}

											}
										}
									}
								}

							}

						}

					}
					for (int i = 0; i < dataSourceListBlock2.size(); i++) {
						if ((Boolean) dataSourceListBlock2.get(i).get("item_selected")) {
							// // 先清空
							// dataSets.remove(dataListArrayList.get(i).get(0));
							// dataSets.remove(dataListArrayList.get(i).get(1));
							// dataSets.remove(dataListArrayList.get(i).get(2));
							// dataSets.remove(dataListArrayList.get(i).get(3));
							if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

							} else {
								// 最后要加上选中的四个通道的所有曲线
								//
								// dataSets.add(dataListArrayList.get(i).get(0));
								// dataSets.add(dataListArrayList.get(i).get(1));
								// dataSets.add(dataListArrayList.get(i).get(2));
								// dataSets.add(dataListArrayList.get(i).get(3));
								if ((activityLayoutTableBeans.get(spinner1Postion).getColor() + "")
										.equals(dataSourceListBlock2.get(i).get("item_image") + "")) {

									if (spinner2Postion == 0) {
										if (spinner3Postion == 0) {
											if (spinner4Postion == 0) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(0));

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(1));

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {

													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(2));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {

													dataSets.add(amplificationUtil.getDataListDeltaArrayList()
															.get(i + 16).get(3));
												}

											} else if (spinner4Postion == 1) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i + 16).get(0));

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i + 16).get(1));

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i + 16).get(2));

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(amplificationUtil.getDataListDeltaSampleArrayList()
															.get(i + 16).get(3));

												}

											}
										} else if (spinner3Postion == 1) {
											if (spinner4Postion == 0) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {

													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(i + 16).get(0));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {

													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(i + 16).get(1));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(i + 16).get(2));

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(amplificationUtil.getDataListDeltaLogArrayList()
															.get(i + 16).get(3));

												}

											} else if (spinner4Postion == 1) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i + 16).get(0));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i + 16).get(1));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i + 16).get(2));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(amplificationUtil.getDataListDeltaLogSampleArrayList()
															.get(i + 16).get(3));
												}

											}
										}
									} else if (spinner2Postion == 1) {
										if (spinner3Postion == 0) {
											if (spinner4Postion == 0) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(dataListArrayList.get(i + 16).get(0));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(dataListArrayList.get(i + 16).get(1));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(dataListArrayList.get(i + 16).get(2));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListArrayList.get(i + 16).get(3));
												}

											} else if (spinner4Postion == 1) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(dataListSampleArrayList.get(i + 16).get(0));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(dataListSampleArrayList.get(i + 16).get(1));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(dataListSampleArrayList.get(i + 16).get(2));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListSampleArrayList.get(i + 16).get(3));
												}

											}
										} else if (spinner3Postion == 1) {
											if (spinner4Postion == 0) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(dataListLogArrayList.get(i + 16).get(0));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(dataListLogArrayList.get(i + 16).get(1));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(dataListLogArrayList.get(i + 16).get(2));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListLogArrayList.get(i + 16).get(3));
												}

											} else if (spinner4Postion == 1) {
												if (((Integer) dataSourceListBlock2.get(i).get("item_aisle")) == 0) {

												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 1) {
													dataSets.add(dataListLogSampleArrayList.get(i + 16).get(0));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 2) {
													dataSets.add(dataListLogSampleArrayList.get(i + 16).get(1));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 3) {
													dataSets.add(dataListLogSampleArrayList.get(i + 16).get(2));
												} else if (((Integer) dataSourceListBlock2.get(i)
														.get("item_aisle")) == 4) {
													dataSets.add(dataListLogSampleArrayList.get(i + 16).get(3));
												}

											}
										}
									} else if (spinner2Postion == 2) {
										// if (spinner3Postion == 0) {
										// if (spinner4Postion == 0) {
										//
										// } else if (spinner4Postion == 1) {
										//
										// }
										// } else if (spinner3Postion == 1) {
										// if (spinner4Postion == 0) {
										//
										// } else if (spinner4Postion == 1) {
										//
										// }
										// }

										for (int j = 0; j < data_list1.size() - 1; j++) {
											if (data_list1.get(j).equals(
													activityLayoutTableBeans.get(spinner1Postion).getTarget())) {
												if (dataSourceListBlock2.get(i).get("item_image")
														.equals(activityLayoutTableBeans.get(spinner1Postion).getColor()
																+ "")) {
													dataSets.add(
															amplificationUtil.getDataListCTArrayList().get(i + 16));

												}

											}
										}
									}
								}
							}

						}

					}

					// activityLayoutTableBeans.get(position).getColor();

					// 选择其他的思路和All一样。先删再加
					// for (int i = 0; i < dataSourceListBlock1.size(); i++) {
					// if ((Boolean) dataSourceListBlock1.get(i).get(
					// "item_selected")) {
					// // 先清空
					// dataSets.remove(dataListArrayList.get(i).get(0));
					// dataSets.remove(dataListArrayList.get(i).get(1));
					// dataSets.remove(dataListArrayList.get(i).get(2));
					// dataSets.remove(dataListArrayList.get(i).get(3));
					//
					// // 然后判断颜色是否一致。颜色一致的加。
					// // 判断通道是否是一个。是显示曲线
					// // 因为名字可能重复。所以决定用颜色做判断
					// if ((activityLayoutTableBeans.get(spinner1Postion)
					// .getColor() + "")
					// .equals(dataSourceListBlock1.get(i).get(
					// "item_image")
					// + "")) {
					// // 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
					// if (((Integer) dataSourceListBlock1.get(i).get(
					// "item_aisle")) == 0) {
					//
					// } else if (((Integer) dataSourceListBlock1.get(
					// i).get("item_aisle")) == 1) {
					// dataSets.add(dataListArrayList.get(i)
					// .get(0));
					// } else if (((Integer) dataSourceListBlock1.get(
					// i).get("item_aisle")) == 2) {
					// dataSets.add(dataListArrayList.get(i)
					// .get(1));
					// } else if (((Integer) dataSourceListBlock1.get(
					// i).get("item_aisle")) == 3) {
					// dataSets.add(dataListArrayList.get(i)
					// .get(2));
					// } else if (((Integer) dataSourceListBlock1.get(
					// i).get("item_aisle")) == 4) {
					// dataSets.add(dataListArrayList.get(i)
					// .get(3));
					// }
					// }
					// }
					// }
					// for (int i = 0; i < dataSourceListBlock2.size(); i++) {
					// if ((Boolean) dataSourceListBlock2.get(i).get(
					// "item_selected")) {
					//
					// // 先清空
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(0));
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(1));
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(2));
					// dataSets.remove(dataListArrayList.get(i + 16)
					// .get(3));
					//
					// // 然后判断颜色是否一致。颜色一致的加。
					// // 判断通道是否是一个。是显示曲线
					// // 因为名字可能重复。所以决定用颜色做判断
					// if ((activityLayoutTableBeans.get(spinner1Postion)
					// .getColor() + "")
					// .equals(dataSourceListBlock2.get(i).get(
					// "item_image")
					// + "")) {
					// // 获得基因盘哪个有通道，通道值为1~4.通道为0表示无数据
					// if (((Integer) dataSourceListBlock2.get(i).get(
					// "item_aisle")) == 0) {
					//
					// } else if (((Integer) dataSourceListBlock2.get(
					// i).get("item_aisle")) == 1) {
					// dataSets.add(dataListArrayList.get(i + 16)
					// .get(0));
					// } else if (((Integer) dataSourceListBlock2.get(
					// i).get("item_aisle")) == 2) {
					// dataSets.add(dataListArrayList.get(i + 16)
					// .get(1));
					// } else if (((Integer) dataSourceListBlock2.get(
					// i).get("item_aisle")) == 3) {
					// dataSets.add(dataListArrayList.get(i + 16)
					// .get(2));
					// } else if (((Integer) dataSourceListBlock2.get(
					// i).get("item_aisle")) == 4) {
					// dataSets.add(dataListArrayList.get(i + 16)
					// .get(3));
					// }
					// }
					//
					// }
					// }

					// 获取spinner1具体是哪个target然后显示那个ctsetting数据
					// chooseNameString
					for (CtSettingBean bean : amplificationUtil.getCtSettingBeans()) {
						if (bean.getTargetName().equals(chooseNameString)) {
							AutoCbState = 1;
							numberTv.setText(bean.getThreshold());
							AutoCb.setChecked(bean.isAutoThreshold());
							AutoBLCb.setChecked(bean.isAutoBaseLine());

						}
					}

					if (BLEndCb.isChecked()) {

						// 32个基因盘 每个基因盘有4个通道

						for (int i = 0; i < 16; i++) {
							if (Boolean.parseBoolean(dataSourceListBlock1.get(i).get("item_selected") + "")
									& (!TextUtils.isEmpty(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
													.getBaselineEndString()))) {

								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
									if (j != Integer.parseInt(passReferenceNum) - 1) {

										if (dataListArrayList.get(i).get(j) != null) {
											if (amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {
												if (spinner2Postion == 0) {
													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = amplificationUtil.getDataListDeltaArrayList().get(i)
																.get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaArrayList().get(i)
																.get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													} else if (spinner3Postion == 1) {
														fStart = amplificationUtil.getDataListDeltaLogArrayList().get(i)
																.get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(i)
																.get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													}

													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineEndString())));
													}

												} else if (spinner2Postion == 1) {
													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = dataListArrayList.get(i).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = dataListArrayList.get(i).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													} else if (spinner3Postion == 1) {
														fStart = dataListLogArrayList.get(i).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = dataListLogArrayList.get(i).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													}

													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineEndString())));
													}

												}

											}
										}
									}
								}

							}
						}
						for (int i = 0; i < 16; i++) {
							if (Boolean.parseBoolean(dataSourceListBlock2.get(i).get("item_selected") + "")
									& (!TextUtils.isEmpty(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
													.getBaselineEndString()))) {

								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
									if (j != Integer.parseInt(passReferenceNum) - 1) {

										if (dataListArrayList.get(i + 16).get(j) != null) {

											if (amplificationUtil.getAdvancedSettingBeans().get(i + 16).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {

												if (spinner2Postion == 0) {

													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = amplificationUtil.getDataListDeltaArrayList()
																.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaArrayList().get(i + 16)
																.get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);
													} else if (spinner3Postion == 1) {
														fStart = amplificationUtil.getDataListDeltaLogArrayList()
																.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaLogArrayList()
																.get(i + 16).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);
													}

													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineEndString())));
													}

												} else if (spinner2Postion == 1) {
													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = dataListArrayList.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = dataListArrayList.get(i + 16).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);

													} else if (spinner3Postion == 1) {
														fStart = dataListLogArrayList.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = dataListLogArrayList.get(i + 16).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);

													}
													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineEndString())));
													}

												}

											} else {

											}

										}
									}

								}

							}
						}

						// for (int i = 0; i < 32; i++) {
						// for (int j = 0; j < 4; j++) {
						// //
						// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
						// //
						// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
						//
						// if (dataListArrayList.get(i).get(j) != null) {
						//
						// if (amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getTargetName()
						// .equals(data_list1
						// .get(spinner1Postion))) {
						//
						//
						// float fStart = dataListArrayList
						// .get(i)
						// .get(j)
						// .getYValForXIndex(
						// Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineStart()) - 1);
						// float fEnd = dataListArrayList
						// .get(i)
						// .get(j)
						// .getYValForXIndex(
						// (Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineEndString())) - 1);
						//
						// dataSets.add(createStartPoint(
						// fStart,
						// Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineStart())));
						// dataSets.add(createEndPoint(
						// fEnd,
						// Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineEndString())));
						// } else {
						//
						// }
						//
						// } else {
						//
						// }
						//
						// }
						//
						// }

					} else {

					}

					// 如果没选all后面才可以操作
					AutoCb.setClickable(true);
					numberTv.setClickable(true);
					AutoBLCb.setClickable(true);

				}

				LineData lineData = new LineData(xValues, dataSets);

				// mLineChart2.setBackgroundColor(Color.BLUE);
				chart.setGridBackgroundColor(Color.WHITE);
				// 将数据插入
				chart.setData(lineData);
				Legend mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);
				chart.animateX(0); // 立即执行的动画,x轴

			} finally {
				messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
			}

		}

	};
	// 构建Runnable对象，在runnable中更新界面
	Runnable runnableBaseLineUi = new Runnable() {
		@Override
		public void run() {
			// 更新界面

			try {

				ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
				for (int i = (dataSets.size() - 1); i >= 0; i--) {
					if (dataSets.get(i).getYVals().size() == 1) {
						intsArrayList.add(i);
					}

				}
				for (int i = 0; i < intsArrayList.size(); i++) {
					dataSets.remove((int) intsArrayList.get(i));
				}

				// 当选中的时候
				if (BLEndCb.isChecked()) {

					if ("All".equals(data_list1.get(spinner1Postion))) {

						// 32个基因盘 每个基因盘有4个通道

						for (int i = 0; i < 16; i++) {
							if (Boolean.parseBoolean(dataSourceListBlock1.get(i).get("item_selected") + "")
									& (!TextUtils.isEmpty(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
													.getBaselineEndString()))) {

								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()

									if (j != Integer.parseInt(passReferenceNum) - 1) {

										if (dataListArrayList.get(i).get(j) != null) {

											if (spinner2Postion == 0) {
												float fStart = 0;
												float fEnd = 0;
												if (spinner3Postion == 0) {
													fStart = amplificationUtil.getDataListDeltaArrayList().get(i).get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineStart())
																	- 1);
													fEnd = amplificationUtil.getDataListDeltaArrayList().get(i).get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineEndString()))
																	- 1);
												} else if (spinner3Postion == 1) {
													fStart = amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineStart())
																	- 1);
													fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(i)
															.get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineEndString()))
																	- 1);
												}

												if (fStart == 0 && fEnd == 0) {

												} else {
													dataSets.add(createStartPoint(fStart,
															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																	.get(i).getBaselineStart())));
													dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
															.getAdvancedSettingBeans().get(i).getBaselineEndString())));
												}

											} else if (spinner2Postion == 1) {
												float fStart = 0;
												float fEnd = 0;
												if (spinner3Postion == 0) {
													fStart = dataListArrayList.get(i).get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineStart())
																	- 1);
													fEnd = dataListArrayList.get(i).get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineEndString()))
																	- 1);
												} else if (spinner3Postion == 1) {
													fStart = dataListLogArrayList.get(i).get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineStart())
																	- 1);
													fEnd = dataListLogArrayList.get(i).get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans().get(i)
																			.getBaselineEndString()))
																	- 1);
												}

												if (fStart == 0 && fEnd == 0) {

												} else {
													dataSets.add(createStartPoint(fStart,
															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																	.get(i).getBaselineStart())));
													dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
															.getAdvancedSettingBeans().get(i).getBaselineEndString())));
												}

											}

											// if (spinner2Postion == 0) {
											//
											// float fStart =
											// amplificationUtil.getDataListDeltaArrayList().get(i)
											// .get(j)
											// .getYValForXIndex(Integer.parseInt(amplificationUtil
											// .getAdvancedSettingBeans().get(i).getBaselineStart())
											// - 1);
											// float fEnd =
											// amplificationUtil.getDataListDeltaArrayList().get(i).get(j)
											// .getYValForXIndex((Integer
											// .parseInt(amplificationUtil.getAdvancedSettingBeans()
											// .get(i).getBaselineEndString()))
											// - 1);
											//
											// dataSets.add(createStartPoint(fStart,
											// Integer.parseInt(amplificationUtil
											// .getAdvancedSettingBeans().get(i).getBaselineStart())));
											// dataSets.add(createEndPoint(fEnd,
											// Integer.parseInt(amplificationUtil
											// .getAdvancedSettingBeans().get(i).getBaselineEndString())));
											//
											// } else if (spinner2Postion == 1)
											// {
											//
											// float fStart =
											// dataListArrayList.get(i).get(j)
											// .getYValForXIndex(Integer.parseInt(amplificationUtil
											// .getAdvancedSettingBeans().get(i).getBaselineStart())
											// - 1);
											// float fEnd =
											// dataListArrayList.get(i).get(j)
											// .getYValForXIndex((Integer
											// .parseInt(amplificationUtil.getAdvancedSettingBeans()
											// .get(i).getBaselineEndString()))
											// - 1);
											//
											// dataSets.add(createStartPoint(fStart,
											// Integer.parseInt(amplificationUtil
											// .getAdvancedSettingBeans().get(i).getBaselineStart())));
											// dataSets.add(createEndPoint(fEnd,
											// Integer.parseInt(amplificationUtil
											// .getAdvancedSettingBeans().get(i).getBaselineEndString())));
											// }

										}
									}
								}

							}
						}
						for (int i = 0; i < 16; i++) {
							if (Boolean.parseBoolean(dataSourceListBlock2.get(i).get("item_selected") + "")
									& (!TextUtils.isEmpty(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
													.getBaselineEndString()))) {

								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
									if (j != Integer.parseInt(passReferenceNum) - 1) {

										if (dataListArrayList.get(i + 16).get(j) != null) {

											if (spinner2Postion == 0) {
												float fStart = 0;
												float fEnd = 0;
												if (spinner3Postion == 0) {
													fStart = amplificationUtil.getDataListDeltaArrayList().get(i + 16)
															.get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineStart())
																	- 1);
													fEnd = amplificationUtil.getDataListDeltaArrayList().get(i + 16)
															.get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineEndString()))
																	- 1);
												} else if (spinner3Postion == 1) {
													fStart = amplificationUtil.getDataListDeltaLogArrayList()
															.get(i + 16).get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineStart())
																	- 1);
													fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(i + 16)
															.get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineEndString()))
																	- 1);
												}

												if (fStart == 0 && fEnd == 0) {

												} else {
													dataSets.add(createStartPoint(fStart,
															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																	.get(i + 16).getBaselineStart())));
													dataSets.add(
															createEndPoint(fEnd,
																	Integer.parseInt(amplificationUtil
																			.getAdvancedSettingBeans().get(i + 16)
																			.getBaselineEndString())));
												}

											} else if (spinner2Postion == 1) {

												float fStart = 0;
												float fEnd = 0;

												if (spinner3Postion == 0) {
													fStart = dataListArrayList.get(i + 16).get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineStart())
																	- 1);
													fEnd = dataListArrayList.get(i + 16).get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineEndString()))
																	- 1);
												} else if (spinner3Postion == 1) {
													fStart = dataListLogArrayList.get(i + 16).get(j)
															.getYValForXIndex(Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineStart())
																	- 1);
													fEnd = dataListLogArrayList.get(i + 16).get(j)
															.getYValForXIndex((Integer.parseInt(
																	amplificationUtil.getAdvancedSettingBeans()
																			.get(i + 16).getBaselineEndString()))
																	- 1);
												}
												if (fStart == 0 && fEnd == 0) {

												} else {
													dataSets.add(createStartPoint(fStart,
															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																	.get(i + 16).getBaselineStart())));
													dataSets.add(
															createEndPoint(fEnd,
																	Integer.parseInt(amplificationUtil
																			.getAdvancedSettingBeans().get(i + 16)
																			.getBaselineEndString())));
												}

											}

										}
									}

								}

							}
						}

					} else {

						// 32个基因盘 每个基因盘有4个通道

						for (int i = 0; i < 16; i++) {
							if (Boolean.parseBoolean(dataSourceListBlock1.get(i).get("item_selected") + "")
									& (!TextUtils.isEmpty(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
													.getBaselineEndString()))) {

								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
									if (j != Integer.parseInt(passReferenceNum) - 1) {

										if (dataListArrayList.get(i).get(j) != null) {
											if (amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {
												if (spinner2Postion == 0) {
													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = amplificationUtil.getDataListDeltaArrayList().get(i)
																.get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaArrayList().get(i)
																.get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													} else if (spinner3Postion == 1) {
														fStart = amplificationUtil.getDataListDeltaLogArrayList().get(i)
																.get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(i)
																.get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													}

													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineEndString())));
													}

												} else if (spinner2Postion == 1) {
													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = dataListArrayList.get(i).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = dataListArrayList.get(i).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													} else if (spinner3Postion == 1) {
														fStart = dataListLogArrayList.get(i).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineStart())
																		- 1);
														fEnd = dataListLogArrayList.get(i).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i).getBaselineEndString()))
																		- 1);
													}

													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i)
																				.getBaselineEndString())));
													}

												}

											}
										}
									}
								}

							}
						}
						for (int i = 0; i < 16; i++) {
							if (Boolean.parseBoolean(dataSourceListBlock2.get(i).get("item_selected") + "")
									& (!TextUtils.isEmpty(
											amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart())
											& !TextUtils.isEmpty(amplificationUtil.getAdvancedSettingBeans().get(i)
													.getBaselineEndString()))) {

								for (int j = 0; j < 4; j++) {
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
									// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
									if (j != Integer.parseInt(passReferenceNum) - 1) {

										if (dataListArrayList.get(i + 16).get(j) != null) {

											if (amplificationUtil.getAdvancedSettingBeans().get(i + 16).getTargetName()
													.equals(data_list1.get(spinner1Postion))) {

												if (spinner2Postion == 0) {

													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = amplificationUtil.getDataListDeltaArrayList()
																.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaArrayList().get(i + 16)
																.get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);
													} else if (spinner3Postion == 1) {
														fStart = amplificationUtil.getDataListDeltaLogArrayList()
																.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = amplificationUtil.getDataListDeltaLogArrayList()
																.get(i + 16).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);
													}

													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineEndString())));
													}

												} else if (spinner2Postion == 1) {
													float fStart = 0;
													float fEnd = 0;
													if (spinner3Postion == 0) {
														fStart = dataListArrayList.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = dataListArrayList.get(i + 16).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);

													} else if (spinner3Postion == 1) {
														fStart = dataListLogArrayList.get(i + 16).get(j)
																.getYValForXIndex(Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineStart())
																		- 1);
														fEnd = dataListLogArrayList.get(i + 16).get(j)
																.getYValForXIndex((Integer.parseInt(
																		amplificationUtil.getAdvancedSettingBeans()
																				.get(i + 16).getBaselineEndString()))
																		- 1);

													}
													if (fStart == 0 && fEnd == 0) {

													} else {
														dataSets.add(
																createStartPoint(fStart,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineStart())));
														dataSets.add(
																createEndPoint(fEnd,
																		Integer.parseInt(amplificationUtil
																				.getAdvancedSettingBeans().get(i + 16)
																				.getBaselineEndString())));
													}

												}

											} else {

											}

										}
									}

								}

							}
						}

						// for (int i = 0; i < 32; i++) {
						// for (int j = 0; j < 4; j++) {
						// //
						// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
						// //
						// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()
						//
						// if (dataListArrayList.get(i).get(j) != null) {
						//
						// if (amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getTargetName()
						// .equals(data_list1
						// .get(spinner1Postion))) {
						//
						//
						// float fStart = dataListArrayList
						// .get(i)
						// .get(j)
						// .getYValForXIndex(
						// Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineStart()) - 1);
						// float fEnd = dataListArrayList
						// .get(i)
						// .get(j)
						// .getYValForXIndex(
						// (Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineEndString())) - 1);
						//
						// dataSets.add(createStartPoint(
						// fStart,
						// Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineStart())));
						// dataSets.add(createEndPoint(
						// fEnd,
						// Integer.parseInt(amplificationUtil
						// .getAdvancedSettingBeans()
						// .get(i)
						// .getBaselineEndString())));
						// } else {
						//
						// }
						//
						// } else {
						//
						// }
						//
						// }
						//
						// }

					}
				}
				LineData lineData = new LineData(xValues, dataSets);
				chart.setGridBackgroundColor(Color.WHITE);
				chart.setData(lineData);
				Legend mLegend = chart.getLegend(); //
				// 设置比例图标示，就是那个一组y的value的
				mLegend.setXEntrySpace(7f);
				mLegend.setYEntrySpace(5f);
				chart.animateX(0);

			} finally {
				BLEndCb.setEnabled(true);
				messageListener.sendEmptyMessage(TASK_LOOP_COMPLETE);
			}

		}

	};
	private ArrayList<LineDataSet> lineDataSets;

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {

		// 点击文件夹编辑，返回时传数据
		if (requestCode == 101 && resultCode == 201) {
			String result = data.getExtras().getString("result");
			numberTv.setText(result);
			for (int i = 0; i < dataSets.size(); i++) {
				for (LineDataSet line : lineDataSets) {
					try {
						if (dataSets.get(i).toString().equals(line.toString())) {
							dataSets.remove(i);
						}
					} catch (Exception e) {
						// TODO: handle exception
					}

				}
			}
			for (int i = 0; i < amplificationUtil.getCtSettingBeans().size(); i++) {
				if (amplificationUtil.getCtSettingBeans().get(i).getTargetName()
						.equals(data_list1.get(spinner1Postion))) {
					amplificationUtil.getCtSettingBeans().get(i).setAutoThreshold(false);
					amplificationUtil.getCtSettingBeans().get(i).setThreshold(numberTv.getText() + "");
				}
			}

			// 写文件 将数据写进文件

			FileManagerUtil fileManagerUtil = new FileManagerUtil();
			// 创建文件
			String folderName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
					BaseApplication.FILEMANGER_PREPAREFOLDERPATH, "0") + "";
			String fileName = SharedPreferencesUtils.get(AnalyzeAmplificationplotActivity.this,
					BaseApplication.FILEMANGER_PREPAREFILENAME, "0") + "";

			// 这个方法和之前的一样，先一行一行的全部取出来。然后当遇到本页面数据。我们不做添加然后在这时我们要加入接下来的文件的数据
			String path = appFilePath + "/" + folderName;
			File file = new File(path + "/" + fileName);
			BufferedReader reader = null;
			StringBuffer contextString = new StringBuffer();
			try {
				System.out.println("以行为单位读取文件内容，一次读一整行:");
				reader = new BufferedReader(new FileReader(file));

				String tempString = "";
				int line = 1;
				// 一次读入一行，直到读入null为文件结束
				Boolean layoutOneBoolean = false;
				while ((tempString = reader.readLine()) != null) {
					// 显示行号
					// System.out.println("line " + line + ": "
					// +
					// tempString);
					// Log.e("--", tempString);
					if (tempString.contains("ParameterSetting")) {
						break;
					}

					contextString.append(tempString);
					contextString.append("\r\n");
					line++;
				}

				reader.close();

			} catch (IOException e) {
				e.printStackTrace();
			} finally {
				if (reader != null) {
					try {
						reader.close();
						// LogUtil.e("!!", contextString + "");

					} catch (IOException e1) {
					}
				}
			}

			// StringBuffer content = new StringBuffer();

			contextString.append("ParameterSetting" + "\r\n");
			contextString.append("\r\n" + "default" + "\r\n");
			contextString.append("\r\n" + "defaultThresholdBoo" + ":" + amplificationUtil.getDefaultThresholdBoo());
			contextString.append("\r\n" + "defaultThreshold" + ":" + amplificationUtil.getDefaultThreshold());
			contextString.append("\r\n" + "defaultBaselineBoo" + ":" + amplificationUtil.getDefaultBaselineBoo());
			contextString.append("\r\n" + "defaultStart" + ":" + amplificationUtil.getDefaultStart());
			contextString.append("\r\n" + "defaultEnd" + ":" + amplificationUtil.getDefaultEnd());

			contextString.append("\r\n" + "\r\n" + "ctSettingBeans" + "\r\n");
			for (int i = 0; i < amplificationUtil.getCtSettingBeans().size(); i++) {
				contextString.append(
						"\r\n" + "targetName" + ":" + amplificationUtil.getCtSettingBeans().get(i).getTargetName());
				contextString.append(
						"\r\n" + "threshold" + ":" + amplificationUtil.getCtSettingBeans().get(i).getThreshold());
				contextString.append("\r\n" + "baselineStart" + ":"
						+ amplificationUtil.getCtSettingBeans().get(i).getBaselineStart());
				contextString.append(
						"\r\n" + "baselineEnd" + ":" + amplificationUtil.getCtSettingBeans().get(i).getBaselineEnd());
				contextString.append("\r\n" + "useDaultSetting" + ":"
						+ amplificationUtil.getCtSettingBeans().get(i).isUseDaultSetting());
				contextString.append("\r\n" + "isAutoThreshold" + ":"
						+ amplificationUtil.getCtSettingBeans().get(i).isAutoThreshold());
				contextString.append("\r\n" + "isAutoBaseLine" + ":"
						+ amplificationUtil.getCtSettingBeans().get(i).isAutoBaseLine());

			}
			if (amplificationUtil.getAdvancedSettingBeans() != null
					&& amplificationUtil.getAdvancedSettingBeans().size() > 0) {
				contextString.append("\r\n" + "\r\n" + "advancedSettingBeans" + "\r\n");
				for (int i = 0; i < amplificationUtil.getAdvancedSettingBeans().size(); i++) {
					contextString.append(
							"\r\n" + "well" + ":" + amplificationUtil.getAdvancedSettingBeans().get(i).getWell());
					contextString.append("\r\n" + "targetName" + ":"
							+ amplificationUtil.getAdvancedSettingBeans().get(i).getTargetName());
					contextString.append("\r\n" + "baseLineName" + ":"
							+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaseLine());
					contextString.append("\r\n" + "baselineStart" + ":"
							+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart());
					contextString.append("\r\n" + "baselineEnd" + ":"
							+ amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString());
					contextString.append("\r\n" + "useCTSetingBoo" + ":"
							+ amplificationUtil.getAdvancedSettingBeans().get(i).getUseCTSetingBoo());
					contextString.append("\r\n" + "autoBaselineBoolean" + ":"
							+ amplificationUtil.getAdvancedSettingBeans().get(i).getAutoBaselineBoolean());
				}

			}

			fileManagerUtil.createFIle(folderName, fileName);
			fileManagerUtil.writeFile(folderName, fileName, "" + contextString, false);
			for (CtSettingBean bean : amplificationUtil.getCtSettingBeans()) {
				if (bean.getTargetName().equals(data_list1.get(spinner1Postion))) {
					LineDataSet line;
					ArrayList<Entry> yValue = new ArrayList<Entry>();
					for (int i = 0; i < repititions; i++) {
						yValue.add(new Entry(Float.parseFloat(bean.getThreshold().trim()), i));
					}

					line = new LineDataSet(yValue, "");
					line.setColor(Color.RED);
					line.setCircleSize(0);
					// line.setDrawCircleHole(true);

					line.setCircleColor(Color.RED);
					line.setValueTextSize(0);
					lineDataSets.set(spinner1Postion, line);
				}

				// lineDataSets.add(line);
			}

			if (ThresholdCb.isChecked()) {
				// 先判断是不是all
				if ("All".equals(data_list1.get(spinner1Postion))) {
					for (LineDataSet line : lineDataSets) {
						dataSets.add(line);

					}
					// 将数据插入
					LineData lineData = new LineData(xValues, dataSets);
					chart.setGridBackgroundColor(Color.WHITE);
					chart.setData(lineData);
					Legend mLegend = chart.getLegend(); //
					// 设置比例图标示，就是那个一组y的value的
					mLegend.setXEntrySpace(7f);
					mLegend.setYEntrySpace(5f);
					chart.animateX(0); // 立即执行的动画,x轴
				} else {
					dataSets.add(lineDataSets.get(spinner1Postion));
					LineData lineData = new LineData(xValues, dataSets);
					chart.setGridBackgroundColor(Color.WHITE);
					chart.setData(lineData);
					Legend mLegend = chart.getLegend(); //
					// 设置比例图标示，就是那个一组y的value的
					mLegend.setXEntrySpace(7f);
					mLegend.setYEntrySpace(5f);
					chart.animateX(0); // 立即执行的动画,x轴
				}
			} else {
				if ("All".equals(data_list1.get(spinner1Postion))) {
					for (LineDataSet line : lineDataSets) {

						dataSets.remove(line);
					}
					LineData lineData = new LineData(xValues, dataSets);
					chart.setGridBackgroundColor(Color.WHITE);
					chart.setData(lineData);
					Legend mLegend = chart.getLegend(); //
					// 设置比例图标示，就是那个一组y的value的
					mLegend.setXEntrySpace(7f);
					mLegend.setYEntrySpace(5f);
					chart.animateX(0); // 立即执行的动画,x轴
				} else {
					// for (LineDataSet line : lineDataSets) {
					// dataSets.remove(line);
					// }

					dataSets.remove(lineDataSets.get(spinner1Postion));

					LineData lineData = new LineData(xValues, dataSets);
					chart.setGridBackgroundColor(Color.WHITE);
					chart.setData(lineData);
					Legend mLegend = chart.getLegend(); //
					// 设置比例图标示，就是那个一组y的value的
					mLegend.setXEntrySpace(7f);
					mLegend.setYEntrySpace(5f);
					chart.animateX(0); // 立即执行的动画,x轴
				}
			}

		}
		// 点击文件夹编辑，返回时传不数据
		if (requestCode == 101 && resultCode == 202) {

		}

	}

	public LineDataSet createStartPoint(float f, int index) {
		LineDataSet point;
		ArrayList<Entry> yValue = new ArrayList<Entry>();
		yValue.add(new Entry(f, index - 1));

		point = new LineDataSet(yValue, "");
		point.setColor(Color.BLACK);
		point.setCircleSize(4);
		point.setDrawCircleHole(true);

		point.setCircleColor(Color.GREEN);
		point.setValueTextSize(0);

		return point;
	}

	public LineDataSet createEndPoint(float f, int index) {
		LineDataSet point;
		ArrayList<Entry> yValue = new ArrayList<Entry>();
		yValue.add(new Entry(f, index - 1));

		point = new LineDataSet(yValue, "");
		point.setColor(Color.BLACK);
		point.setCircleSize(4);
		point.setDrawCircleHole(true);

		point.setCircleColor(Color.RED);
		point.setValueTextSize(0);

		return point;
	}

	private void addBLEND2ALL(int position, int type) {
		for (int j = 0; j < 4; j++) {
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()

			if (dataListArrayList.get(position + 16).get(j) != null) {

				if (spinner2Postion == 0) {
					float fStart = 0;
					float fEnd = 0;

					if (spinner3Postion == 0) {
						fStart = amplificationUtil.getDataListDeltaArrayList().get(position + 16).get(j)
								.getYValForXIndex(Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
										.get(position + 16).getBaselineStart()) - 1);
						fEnd = amplificationUtil.getDataListDeltaArrayList().get(position + 16).get(j)
								.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
										.get(position + 16).getBaselineEndString())) - 1);
					} else if (spinner3Postion == 1) {
						fStart = amplificationUtil.getDataListDeltaLogArrayList().get(position + 16).get(j)
								.getYValForXIndex(Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
										.get(position + 16).getBaselineStart()) - 1);
						fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(position + 16).get(j)
								.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
										.get(position + 16).getBaselineEndString())) - 1);
					}
					if (fStart != 0 && fEnd != 0) {
						if (type == 1) {
							dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
									.getAdvancedSettingBeans().get(position + 16).getBaselineStart())));
							dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
									.getAdvancedSettingBeans().get(position + 16).getBaselineEndString())));
						} else if (type == 2) {

							ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {
									if (dataSets.get(i).toString()
											.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position + 16).getBaselineStart()))
															.toString())) {
										intsArrayList.add(i);

									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}

							intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {
									if (dataSets.get(i)
											.toString().equals(
													createStartPoint(fEnd,
															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																	.get(position + 16).getBaselineEndString()))
																			.toString())) {
										intsArrayList.add(i);

									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}

						}
					}

				} else if (spinner2Postion == 1) {
					float fStart = 0;
					float fEnd = 0;
					if (spinner3Postion == 0) {
						fStart = dataListArrayList.get(position + 16).get(j).getYValForXIndex(Integer.parseInt(
								amplificationUtil.getAdvancedSettingBeans().get(position + 16).getBaselineStart()) - 1);
						fEnd = dataListArrayList.get(position + 16).get(j).getYValForXIndex((Integer.parseInt(
								amplificationUtil.getAdvancedSettingBeans().get(position + 16).getBaselineEndString()))
								- 1);
					} else if (spinner3Postion == 1) {
						fStart = dataListLogArrayList.get(position + 16).get(j).getYValForXIndex(Integer.parseInt(
								amplificationUtil.getAdvancedSettingBeans().get(position + 16).getBaselineStart()) - 1);
						fEnd = dataListLogArrayList.get(position + 16).get(j).getYValForXIndex((Integer.parseInt(
								amplificationUtil.getAdvancedSettingBeans().get(position + 16).getBaselineEndString()))
								- 1);
					}

					if (fStart != 0 && fEnd != 0) {
						if (type == 1) {
							dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
									.getAdvancedSettingBeans().get(position + 16).getBaselineStart())));
							dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
									.getAdvancedSettingBeans().get(position + 16).getBaselineEndString())));
						} else if (type == 2) {

							ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {

									if (dataSets.get(i).toString()
											.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position + 16).getBaselineStart()))
															.toString())) {
										intsArrayList.add(i);
										break;
									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}
							intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {

									if (dataSets.get(i)
											.toString().equals(
													createEndPoint(fEnd,
															Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																	.get(position + 16).getBaselineEndString()))
																			.toString())) {
										intsArrayList.add(i);
										break;
									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}

						}
					}

				}

			} else {

			}

		}

	}

	private void addBLEND2(int position, int type) {
		for (int j = 0; j < 4; j++) {
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()

			if (dataListArrayList.get(position + 16).get(j) != null) {

				if (amplificationUtil.getAdvancedSettingBeans().get(position + 16).getTargetName()
						.equals(data_list1.get(spinner1Postion))) {

					if (spinner2Postion == 0) {
						float fStart = 0;
						float fEnd = 0;
						if (spinner3Postion == 0) {
							fStart = amplificationUtil.getDataListDeltaArrayList().get(position + 16).get(j)
									.getYValForXIndex(Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position + 16).getBaselineStart()) - 1);
							fEnd = amplificationUtil.getDataListDeltaArrayList().get(position + 16).get(j)
									.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position + 16).getBaselineEndString())) - 1);
						} else if (spinner3Postion == 1) {
							fStart = amplificationUtil.getDataListDeltaLogArrayList().get(position + 16).get(j)
									.getYValForXIndex(Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position + 16).getBaselineStart()) - 1);
							fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(position + 16).get(j)
									.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position + 16).getBaselineEndString())) - 1);
						}
						if (fStart != 0 && fEnd != 0) {
							if (type == 1) {
								dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
										.getAdvancedSettingBeans().get(position + 16).getBaselineStart())));
								dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
										.getAdvancedSettingBeans().get(position + 16).getBaselineEndString())));
							} else if (type == 2) {

								ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
								for (int i = (dataSets.size() - 1); i >= 0; i--) {
									if (dataSets.get(i).getYVals().size() == 1) {
										if (dataSets.get(i).toString()
												.equals(createStartPoint(fStart,
														Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																.get(position + 16).getBaselineStart())).toString())) {
											intsArrayList.add(i);

										}

									}

								}
								for (int i = 0; i < intsArrayList.size(); i++) {
									dataSets.remove((int) intsArrayList.get(i));
								}

								intsArrayList = new ArrayList<Integer>();
								for (int i = (dataSets.size() - 1); i >= 0; i--) {
									if (dataSets.get(i).getYVals().size() == 1) {
										if (dataSets.get(i).toString()
												.equals(createStartPoint(fEnd,
														Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																.get(position + 16).getBaselineEndString()))
																		.toString())) {
											intsArrayList.add(i);

										}

									}

								}
								for (int i = 0; i < intsArrayList.size(); i++) {
									dataSets.remove((int) intsArrayList.get(i));
								}

							}
						}

					} else if (spinner2Postion == 1) {
						float fStart = 0;
						float fEnd = 0;

						if (spinner3Postion == 0) {
							fStart = dataListArrayList.get(position + 16).get(j).getYValForXIndex(Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position + 16).getBaselineStart())
									- 1);
							fEnd = dataListArrayList.get(position + 16).get(j)
									.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position + 16).getBaselineEndString())) - 1);
						} else if (spinner3Postion == 1) {
							fStart = dataListLogArrayList.get(position + 16).get(j).getYValForXIndex(Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position + 16).getBaselineStart())
									- 1);
							fEnd = dataListLogArrayList.get(position + 16).get(j)
									.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position + 16).getBaselineEndString())) - 1);
						}
						if (fStart != 0 && fEnd != 0) {
							if (type == 1) {
								dataSets.add(createStartPoint(fStart, Integer.parseInt(amplificationUtil
										.getAdvancedSettingBeans().get(position + 16).getBaselineStart())));
								dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
										.getAdvancedSettingBeans().get(position + 16).getBaselineEndString())));
							} else if (type == 2) {

								ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
								for (int i = (dataSets.size() - 1); i >= 0; i--) {
									if (dataSets.get(i).getYVals().size() == 1) {

										if (dataSets.get(i).toString()
												.equals(createStartPoint(fStart,
														Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																.get(position + 16).getBaselineStart())).toString())) {
											intsArrayList.add(i);
											break;
										}

									}

								}
								for (int i = 0; i < intsArrayList.size(); i++) {
									dataSets.remove((int) intsArrayList.get(i));
								}
								intsArrayList = new ArrayList<Integer>();
								for (int i = (dataSets.size() - 1); i >= 0; i--) {
									if (dataSets.get(i).getYVals().size() == 1) {

										if (dataSets.get(i).toString()
												.equals(createEndPoint(fEnd,
														Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																.get(position + 16).getBaselineEndString()))
																		.toString())) {
											intsArrayList.add(i);
											break;
										}

									}

								}
								for (int i = 0; i < intsArrayList.size(); i++) {
									dataSets.remove((int) intsArrayList.get(i));
								}

							}
						}

					}

				} else {

				}

			} else {

			}

		}

	}

	private void addBLEND1ALL(int position, int type) {
		for (int j = 0; j < 4; j++) {
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()

			if (dataListArrayList.get(position).get(j) != null) {

				if (spinner2Postion == 0) {
					float fStart = 0;
					float fEnd = 0;
					if (spinner3Postion == 0) {
						fStart = amplificationUtil.getDataListDeltaArrayList().get(position).get(j)
								.getYValForXIndex(Integer.parseInt(
										amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())
										- 1);
						fEnd = amplificationUtil.getDataListDeltaArrayList().get(position).get(j)
								.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
										.get(position).getBaselineEndString())) - 1);
					} else if (spinner3Postion == 1) {
						fStart = amplificationUtil.getDataListDeltaLogArrayList().get(position).get(j)
								.getYValForXIndex(Integer.parseInt(
										amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())
										- 1);
						fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(position).get(j)
								.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
										.get(position).getBaselineEndString())) - 1);
					}

					if (fStart != 0 && fEnd != 0) {
						if (type == 1) {
							dataSets.add(createStartPoint(fStart, Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())));
							dataSets.add(createEndPoint(fEnd, Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineEndString())));

						} else if (type == 2) {
							ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {
									if (dataSets.get(i).toString()
											.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position).getBaselineStart()))
															.toString())) {
										intsArrayList.add(i);

									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}

							intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {
									if (dataSets.get(i).toString()
											.equals(createStartPoint(fEnd, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position).getBaselineEndString()))
															.toString())) {
										intsArrayList.add(i);

									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}

						}

					}

				} else if (spinner2Postion == 1) {

					float fStart = 0;
					float fEnd = 0;
					if (spinner3Postion == 0) {

						fStart = dataListArrayList.get(position).get(j)
								.getYValForXIndex(Integer.parseInt(
										amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())
								- 1);
						fEnd = dataListArrayList.get(position).get(j).getYValForXIndex((Integer.parseInt(
								amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineEndString())) - 1);
					} else if (spinner3Postion == 1) {

						fStart = dataListLogArrayList.get(position).get(j)
								.getYValForXIndex(Integer.parseInt(
										amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())
								- 1);
						fEnd = dataListLogArrayList.get(position).get(j).getYValForXIndex((Integer.parseInt(
								amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineEndString())) - 1);
					}

					if (fStart != 0 && fEnd != 0) {
						if (type == 1) {
							dataSets.add(createStartPoint(fStart, Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())));
							dataSets.add(createEndPoint(fEnd, Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineEndString())));
						} else if (type == 2) {

							ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {

									if (dataSets.get(i).toString()
											.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position).getBaselineStart()))
															.toString())) {
										intsArrayList.add(i);
										break;
									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}
							intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {

									if (dataSets.get(i).toString()
											.equals(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position).getBaselineEndString()))
															.toString())) {
										intsArrayList.add(i);
										break;
									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}

						}
					}

				}

			}
		}

	}

	private void addBLEND1(int position, int type) {

		for (int j = 0; j < 4; j++) {
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineStart()
			// amplificationUtil.getAdvancedSettingBeans().get(i).getBaselineEndString()

			if (dataListArrayList.get(position).get(j) != null) {
				if (amplificationUtil.getAdvancedSettingBeans().get(position).getTargetName()
						.equals(data_list1.get(spinner1Postion))) {
					if (spinner2Postion == 0) {
						float fStart = 0, fEnd = 0;
						if (spinner3Postion == 0) {
							fStart = amplificationUtil.getDataListDeltaArrayList().get(position).get(j)
									.getYValForXIndex(Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position).getBaselineStart()) - 1);
							fEnd = amplificationUtil.getDataListDeltaArrayList().get(position).get(j)
									.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position).getBaselineEndString())) - 1);

						} else if (spinner3Postion == 1) {
							fStart = amplificationUtil.getDataListDeltaLogArrayList().get(position).get(j)
									.getYValForXIndex(Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position).getBaselineStart()) - 1);
							fEnd = amplificationUtil.getDataListDeltaLogArrayList().get(position).get(j)
									.getYValForXIndex((Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
											.get(position).getBaselineEndString())) - 1);

						}
						if (fStart != 0 && fEnd != 0) {
							if (type == 1) {
								dataSets.add(createStartPoint(fStart, Integer.parseInt(
										amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())));
								dataSets.add(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
										.getAdvancedSettingBeans().get(position).getBaselineEndString())));
							} else if (type == 2) {
								ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
								for (int i = (dataSets.size() - 1); i >= 0; i--) {
									if (dataSets.get(i).getYVals().size() == 1) {
										if (dataSets.get(i).toString()
												.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
														.getAdvancedSettingBeans().get(position).getBaselineStart()))
																.toString())) {
											intsArrayList.add(i);

										}

									}

								}
								for (int i = 0; i < intsArrayList.size(); i++) {
									dataSets.remove((int) intsArrayList.get(i));
								}

								intsArrayList = new ArrayList<Integer>();
								for (int i = (dataSets.size() - 1); i >= 0; i--) {
									if (dataSets.get(i).getYVals().size() == 1) {
										if (dataSets.get(i).toString()
												.equals(createStartPoint(fEnd,
														Integer.parseInt(amplificationUtil.getAdvancedSettingBeans()
																.get(position).getBaselineEndString())).toString())) {
											intsArrayList.add(i);

										}

									}

								}
								for (int i = 0; i < intsArrayList.size(); i++) {
									dataSets.remove((int) intsArrayList.get(i));
								}

							}

						}

					} else if (spinner2Postion == 1) {
						float fStart = 0;
						float fEnd = 0;
						if (spinner3Postion == 1) {
							fStart = dataListArrayList.get(position).get(j).getYValForXIndex(Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart()) - 1);
							fEnd = dataListArrayList.get(position).get(j).getYValForXIndex((Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineEndString()))
									- 1);
						} else if (spinner3Postion == 2) {
							fStart = dataListLogArrayList.get(position).get(j).getYValForXIndex(Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart()) - 1);
							fEnd = dataListLogArrayList.get(position).get(j).getYValForXIndex((Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineEndString()))
									- 1);
						}

						if (type == 1) {
							dataSets.add(createStartPoint(fStart, Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineStart())));
							dataSets.add(createEndPoint(fEnd, Integer.parseInt(
									amplificationUtil.getAdvancedSettingBeans().get(position).getBaselineEndString())));
						} else if (type == 2) {
							ArrayList<Integer> intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {

									if (dataSets.get(i).toString()
											.equals(createStartPoint(fStart, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position).getBaselineStart()))
															.toString())) {
										intsArrayList.add(i);
										break;
									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}
							intsArrayList = new ArrayList<Integer>();
							for (int i = (dataSets.size() - 1); i >= 0; i--) {
								if (dataSets.get(i).getYVals().size() == 1) {

									if (dataSets.get(i).toString()
											.equals(createEndPoint(fEnd, Integer.parseInt(amplificationUtil
													.getAdvancedSettingBeans().get(position).getBaselineEndString()))
															.toString())) {
										intsArrayList.add(i);
										break;
									}

								}

							}
							for (int i = 0; i < intsArrayList.size(); i++) {
								dataSets.remove((int) intsArrayList.get(i));
							}
						}

					}

				}
			}
		}

	}

	private void spinner22Util(int position, boolean type, int block) {
		if(amplificationUtil.getDataListCTArrayList().size() ==0){
			amplificationUtil = new AmplificationUtil();
			amplificationUtil.getAnalySetting(context, dataSourceListBlock1, dataSourceListBlock2, repititions,
					dataListArrayList);

			amplificationUtil.generateDeltaline(dataListArrayList, repititions);
		}
		if (type) {
			if (block == 1) {
				if (spinner1Postion == data_list1.size() - 1) {
					dataSets.add(amplificationUtil.getDataListCTArrayList().get(position));
				} else {
					for (int j = 0; j < data_list1.size() - 1; j++) {
						if (data_list1.get(j).equals(activityLayoutTableBeans.get(spinner1Postion).getTarget())) {
							if (dataSourceListBlock1.get(position).get("item_image")
									.equals(activityLayoutTableBeans.get(spinner1Postion).getColor() + "")) {
								dataSets.add(amplificationUtil.getDataListCTArrayList().get(position));

							}

						}
					}
				}

			} else if (block == 2) {
				if (spinner1Postion == data_list1.size() - 1) {
					dataSets.add(amplificationUtil.getDataListCTArrayList().get(position + 16));
				} else {
					for (int j = 0; j < data_list1.size() - 1; j++) {
						if (data_list1.get(j).equals(activityLayoutTableBeans.get(spinner1Postion).getTarget())) {
							if (dataSourceListBlock2.get(position).get("item_image")
									.equals(activityLayoutTableBeans.get(spinner1Postion).getColor() + "")) {
								dataSets.add(amplificationUtil.getDataListCTArrayList().get(position + 16));

							}

						}
					}
				}

			}

		} else {
			if (block == 1) {
				if (spinner1Postion == data_list1.size() - 1) {
					dataSets.remove(amplificationUtil.getDataListCTArrayList().get(position));
				} else {
					for (int j = 0; j < data_list1.size() - 1; j++) {
						if (data_list1.get(j).equals(activityLayoutTableBeans.get(spinner1Postion).getTarget())) {
							if (dataSourceListBlock1.get(position).get("item_image")
									.equals(activityLayoutTableBeans.get(spinner1Postion).getColor() + "")) {

							}

						}
					}
				}

			} else if (block == 2) {
				if (spinner1Postion == data_list1.size() - 1) {
					dataSets.remove(amplificationUtil.getDataListCTArrayList().get(position + 16));
				} else {
					for (int j = 0; j < data_list1.size() - 1; j++) {
						if (data_list1.get(j).equals(activityLayoutTableBeans.get(spinner1Postion).getTarget())) {
							if (dataSourceListBlock2.get(position).get("item_image")
									.equals(activityLayoutTableBeans.get(spinner1Postion).getColor() + "")) {
								dataSets.remove(amplificationUtil.getDataListCTArrayList().get(position + 16));

							}

						}
					}
				}

			}
		}
		xValues = new ArrayList<String>();
		for (int i = 1; i <= 32; i++) {
			xValues.add(i + "");
		}

	}
}
